From: Ben Dowling Date: Wed, 4 Apr 2012 16:16:57 +0000 (+0200) Subject: Code assumes that details.get(USERNAME) will return a string. That's not the case... X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=d79d685b49666f6809f36715c7a4fc4d062a0be7;p=django-social-auth.git Code assumes that details.get(USERNAME) will return a string. That's not the case with the dropbox backend (which returns an int) and possibly others. Without casting to a string we'll get an error on line 45. The other alternative is to call username_fixer prior to the short_username change, which could do the cast for backends that require it. --- diff --git a/social_auth/backends/pipeline/user.py b/social_auth/backends/pipeline/user.py index ece1d6a..9ebaf03 100644 --- a/social_auth/backends/pipeline/user.py +++ b/social_auth/backends/pipeline/user.py @@ -31,7 +31,7 @@ def get_username(details, user=None, user_exists=simple_user_exists, if setting('SOCIAL_AUTH_FORCE_RANDOM_USERNAME'): username = uuid4().get_hex() elif details.get(USERNAME): - username = details[USERNAME] + username = unicode(details[USERNAME]) elif setting('SOCIAL_AUTH_DEFAULT_USERNAME'): username = setting('SOCIAL_AUTH_DEFAULT_USERNAME') if callable(username):