]> git.parisson.com Git - django-social-auth.git/commitdiff
Avoid keyerror. Closes #391
authorMatías Aguirre <matiasaguirre@gmail.com>
Mon, 9 Jul 2012 03:16:46 +0000 (00:16 -0300)
committerMatías Aguirre <matiasaguirre@gmail.com>
Mon, 9 Jul 2012 03:16:46 +0000 (00:16 -0300)
social_auth/backends/google.py

index f3bd90b301b61e05408f2b9a8bf061d284d9147d..382f33e3322fa4102524f7b4661d9f54afa0dfce 100644 (file)
@@ -58,7 +58,7 @@ class GoogleOAuthBackend(OAuthBackend):
 
     def get_user_details(self, response):
         """Return user details from Orkut account"""
-        email = response['email']
+        email = response.get('email', '')
         return {USERNAME: email.split('@', 1)[0],
                 'email': email,
                 'fullname': '',
@@ -83,7 +83,7 @@ class GoogleOAuth2Backend(GoogleOAuthBackend):
         return user_id
 
     def get_user_details(self, response):
-        email = response['email']
+        email = response.get('email', '')
         return {USERNAME: email.split('@', 1)[0],
                 'email': email,
                 'fullname': response.get('name', ''),