From: Matías Aguirre Date: Fri, 1 Apr 2011 13:51:57 +0000 (-0300) Subject: Fix bug caused by undefined username variable X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=93fb63b2b817e4abf1a1d168d5308616616ebf2c;p=django-social-auth.git Fix bug caused by undefined username variable --- diff --git a/social_auth/backends/__init__.py b/social_auth/backends/__init__.py index a7269ae..b4f6732 100644 --- a/social_auth/backends/__init__.py +++ b/social_auth/backends/__init__.py @@ -144,8 +144,9 @@ class SocialAuthBackend(ModelBackend): username = settings.SOCIAL_AUTH_DEFAULT_USERNAME if callable(username): username = username() - if not username: - username = get_random_username() + else: + username = None + username = username or get_random_username() fixer = getattr(settings, 'SOCIAL_AUTH_USERNAME_FIXER', lambda u: u)