From: Matías Aguirre Date: Wed, 4 Jul 2012 06:39:19 +0000 (-0300) Subject: Misc X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=989b71b4358329a10ae4fb5ae2c3a7b04914fd8e;p=django-social-auth.git Misc --- diff --git a/social_auth/backends/__init__.py b/social_auth/backends/__init__.py index d70f51e..a32b403 100644 --- a/social_auth/backends/__init__.py +++ b/social_auth/backends/__init__.py @@ -331,7 +331,6 @@ class BaseAuth(object): @AUTH_BACKEND Authorization backend related with this service """ - AUTH_BACKEND = None def __init__(self, request, redirect): diff --git a/social_auth/backends/contrib/douban.py b/social_auth/backends/contrib/douban.py index 2be91cb..a380aaa 100644 --- a/social_auth/backends/contrib/douban.py +++ b/social_auth/backends/contrib/douban.py @@ -16,20 +16,23 @@ from social_auth.backends.exceptions import AuthCanceled DOUBAN_SERVER = 'www.douban.com' -DOUBAN_REQUEST_TOKEN_URL = 'http://%s/service/auth/request_token' % DOUBAN_SERVER -DOUBAN_ACCESS_TOKEN_URL = 'http://%s/service/auth/access_token' % DOUBAN_SERVER +DOUBAN_REQUEST_TOKEN_URL = 'http://%s/service/auth/request_token' % \ + DOUBAN_SERVER +DOUBAN_ACCESS_TOKEN_URL = 'http://%s/service/auth/access_token' % \ + DOUBAN_SERVER -DOUBAN_AUTHORIZATION_URL = 'http://%s/service/auth/authorize' % DOUBAN_SERVER +DOUBAN_AUTHORIZATION_URL = 'http://%s/service/auth/authorize' % \ + DOUBAN_SERVER class DoubanBackend(OAuthBackend): """Douban OAuth authentication backend""" name = 'douban' EXTRA_DATA = [('id', 'id')] - + def get_user_id(self, details, response): return response['db:uid']['$t'] - + def get_user_details(self, response): """Return user details from Douban""" return {USERNAME: response["db:uid"]["$t"], @@ -51,7 +54,7 @@ class DoubanAuth(ConsumerBasedOAuth): url = 'http://api.douban.com/people/%40me?&alt=json' request = self.oauth_request(access_token, url) json = self.fetch_response(request) - + try: return simplejson.loads(json) except ValueError: diff --git a/social_auth/backends/contrib/evernote.py b/social_auth/backends/contrib/evernote.py index 71d9373..1429d1d 100644 --- a/social_auth/backends/contrib/evernote.py +++ b/social_auth/backends/contrib/evernote.py @@ -13,8 +13,8 @@ except ImportError: from oauth2 import Token from social_auth.utils import setting -from social_auth.backends import ConsumerBasedOAuth, OAuthBackend, USERNAME,\ - exceptions +from social_auth.backends import ConsumerBasedOAuth, OAuthBackend, USERNAME, \ + exceptions if setting('EVERNOTE_DEBUG', False): diff --git a/social_auth/backends/google.py b/social_auth/backends/google.py index 01e8701..295a3db 100644 --- a/social_auth/backends/google.py +++ b/social_auth/backends/google.py @@ -76,7 +76,8 @@ class GoogleOAuth2Backend(GoogleOAuthBackend): def get_user_id(self, details, response): """Use google email or id as unique id""" - user_id = super(GoogleOAuth2Backend, self).get_user_id(details, response) + user_id = super(GoogleOAuth2Backend, self).get_user_id(details, + response) if setting('GOOGLE_OAUTH2_USE_UNIQUE_USER_ID', False): return response['id'] return user_id