Browse files

Use ValueError instad of JSONDecodeError to support django.utils.simp…

…lejson utility properly on systems where python-simplejson is not present
  • Loading branch information...
1 parent db770a1 commit 0fc1e450548ff8bfb6fc4eb4a987ec9b4412b962 @omab omab committed Apr 18, 2011
View
2 social_auth/backends/__init__.py
@@ -660,7 +660,7 @@ def auth_complete(self, *args, **kwargs):
try:
response = simplejson.loads(urlopen(request).read())
- except (simplejson.JSONDecodeError, KeyError):
+ except (ValueError, KeyError):
raise ValueError('Unknown OAuth2 response type')
if response.get('error'):
View
2 social_auth/backends/contrib/orkut.py
@@ -62,7 +62,7 @@ def user_data(self, access_token):
response = urllib.urlopen(request.to_url()).read()
try:
return simplejson.loads(response)['data']
- except (simplejson.JSONDecodeError, KeyError):
+ except (ValueError, KeyError):
return None
View
2 social_auth/backends/facebook.py
@@ -88,7 +88,7 @@ def user_data(self, access_token):
url = FACEBOOK_CHECK_AUTH + '?' + urllib.urlencode(params)
try:
return simplejson.load(urllib.urlopen(url))
- except simplejson.JSONDecodeError:
+ except ValueError:
return None
@classmethod
View
2 social_auth/backends/google.py
@@ -167,7 +167,7 @@ def googleapis_email(url, params):
request = Request(url + '?' + params, headers={'Authorization': params})
try:
return simplejson.loads(urlopen(request).read())['data']
- except (simplejson.JSONDecodeError, KeyError, IOError):
+ except (ValueError, KeyError, IOError):
return None
View
2 social_auth/backends/twitter.py
@@ -56,7 +56,7 @@ def user_data(self, access_token):
json = self.fetch_response(request)
try:
return simplejson.loads(json)
- except simplejson.JSONDecodeError:
+ except ValueError:
return None

0 comments on commit 0fc1e45

Please sign in to comment.