From 8ed260b84d0e6460fc256e9b7ddaed8841bce61c Mon Sep 17 00:00:00 2001 From: Hassek Date: Mon, 7 May 2012 15:04:21 -0430 Subject: [PATCH] handle expires and drops useless lists on response --- social_auth/backends/contrib/evernote.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/social_auth/backends/contrib/evernote.py b/social_auth/backends/contrib/evernote.py index ad4854a..a8027b6 100644 --- a/social_auth/backends/contrib/evernote.py +++ b/social_auth/backends/contrib/evernote.py @@ -28,7 +28,6 @@ EVERNOTE_AUTHORIZATION_URL = 'https://%s/OAuth.action' % \ EVERNOTE_SERVER -# TODO handle expired token class EvernoteBackend(OAuthBackend): """Evernote OAuth authentication backend Possible Values: @@ -45,7 +44,8 @@ class EvernoteBackend(OAuthBackend): EXTRA_DATA = [ ('access_token', 'access_token'), ('oauth_token', 'oauth_token'), - ('edam_noteStoreUrl', 'store_url') + ('edam_noteStoreUrl', 'store_url'), + ('edam_expires', setting('SOCIAL_AUTH_EXPIRATION', 'expires')) ] def get_user_details(self, response): @@ -83,7 +83,10 @@ class EvernoteAuth(ConsumerBasedOAuth): def user_data(self, access_token, *args, **kwargs): """Return user data provided """ - return access_token.user_info + + # drop lists + return dict([(key, val[0]) for key, val in + access_token.user_info.items()]) # Backend definition BACKENDS = { -- 2.39.5