From: Ravi Kotecha Date: Mon, 2 Jan 2012 10:48:49 +0000 (+0000) Subject: Fix for backend breaking with "KeyError('lastName')" if foursquare user doesn't have... X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=bd1a651c37412e23343e55c2cfdef52aff50a640;p=django-social-auth.git Fix for backend breaking with "KeyError('lastName')" if foursquare user doesn't have a lastName set. --- diff --git a/social_auth/backends/contrib/foursquare.py b/social_auth/backends/contrib/foursquare.py index d4a04f6..9e70d9e 100644 --- a/social_auth/backends/contrib/foursquare.py +++ b/social_auth/backends/contrib/foursquare.py @@ -22,7 +22,7 @@ class FoursquareBackend(OAuthBackend): def get_user_details(self, response): """Return user details from Foursquare account""" firstName = response['response']['user']['firstName'] - lastName = response['response']['user']['lastName'] + lastName = response['response']['user'].get('lastName', '') email = response['response']['user']['contact']['email'] return {USERNAME: firstName + ' ' + lastName,