From: Andres Villavicencio Date: Mon, 9 Jan 2012 05:22:02 +0000 (+0000) Subject: Using dict.get to avoid KeyError X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=e0b25bfd2c97f82ccaeb0cf4fb41f33a995d7fa1;p=django-social-auth.git Using dict.get to avoid KeyError --- diff --git a/social_auth/backends/__init__.py b/social_auth/backends/__init__.py index d87aa06..df8d7ee 100644 --- a/social_auth/backends/__init__.py +++ b/social_auth/backends/__init__.py @@ -114,7 +114,7 @@ class SocialAuthBackend(ModelBackend): # account user = social_user.user user.social_user = social_user - user.is_new = out['is_new'] + user.is_new = out.get('is_new') return user def pipeline(self, pipeline, request, *args, **kwargs):