[Python-modules-commits] [python-social-auth] 231/322: Pass all arguments to extra_data (save access token).
Wolfgang Borgert
debacle at moszumanska.debian.org
Sat Dec 24 15:13:13 UTC 2016
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to tag v0.2.10
in repository python-social-auth.
commit f9caa5ad5d67827e5c759ed11501c85c1172d101
Author: Matías Aguirre <matiasaguirre at gmail.com>
Date: Sat Apr 4 04:12:01 2015 -0300
Pass all arguments to extra_data (save access token).
Fixes #344, #416
---
social/backends/base.py | 2 +-
social/backends/behance.py | 5 +++--
social/backends/disqus.py | 4 ++--
social/backends/evernote.py | 4 ++--
social/backends/exacttarget.py | 2 +-
social/backends/oauth.py | 8 +++++---
social/backends/odnoklassniki.py | 2 +-
social/backends/open_id.py | 4 ++--
social/backends/persona.py | 2 +-
social/backends/pocket.py | 2 +-
social/backends/shopify.py | 4 ++--
social/pipeline/social_auth.py | 3 ++-
12 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/social/backends/base.py b/social/backends/base.py
index bceebb6..3d38590 100644
--- a/social/backends/base.py
+++ b/social/backends/base.py
@@ -115,7 +115,7 @@ class BaseAuth(object):
self.strategy.clean_partial_pipeline()
return out
- def extra_data(self, user, uid, response, details):
+ def extra_data(self, user, uid, response, details=None, *args, **kwargs):
"""Return deafault extra data to store in extra_data field"""
data = {}
for entry in (self.EXTRA_DATA or []) + self.setting('EXTRA_DATA', []):
diff --git a/social/backends/behance.py b/social/backends/behance.py
index bf57de0..8d98d41 100644
--- a/social/backends/behance.py
+++ b/social/backends/behance.py
@@ -30,10 +30,11 @@ class BehanceOAuth2(BaseOAuth2):
'last_name': last_name,
'email': ''}
- def extra_data(self, user, uid, response, details):
+ def extra_data(self, user, uid, response, details=None, *args, **kwargs):
# Pull up the embedded user attributes so they can be found as extra
# data. See the example token response for possible attributes:
# http://www.behance.net/dev/authentication#step-by-step
data = response.copy()
data.update(response['user'])
- return super(BehanceOAuth2, self).extra_data(user, uid, data, details)
+ return super(BehanceOAuth2, self).extra_data(user, uid, data, details,
+ *args, **kwargs)
diff --git a/social/backends/disqus.py b/social/backends/disqus.py
index c36be28..3542a6b 100644
--- a/social/backends/disqus.py
+++ b/social/backends/disqus.py
@@ -37,10 +37,10 @@ class DisqusOAuth2(BaseOAuth2):
'name': rr.get('name', ''),
}
- def extra_data(self, user, uid, response, details):
+ def extra_data(self, user, uid, response, details=None, *args, **kwargs):
meta_response = dict(response, **response.get('response', {}))
return super(DisqusOAuth2, self).extra_data(user, uid, meta_response,
- details)
+ details, *args, **kwargs)
def user_data(self, access_token, *args, **kwargs):
"""Loads user data from service"""
diff --git a/social/backends/evernote.py b/social/backends/evernote.py
index d3eb598..10abef7 100644
--- a/social/backends/evernote.py
+++ b/social/backends/evernote.py
@@ -54,9 +54,9 @@ class EvernoteOAuth(BaseOAuth1):
else:
raise
- def extra_data(self, user, uid, response, details=None):
+ def extra_data(self, user, uid, response, details=None, *args, **kwargs):
data = super(EvernoteOAuth, self).extra_data(user, uid, response,
- details)
+ details, *args, **kwargs)
# Evernote returns expiration timestamp in miliseconds, so it needs to
# be normalized.
if 'expires' in data:
diff --git a/social/backends/exacttarget.py b/social/backends/exacttarget.py
index ca49ac9..7d114be 100644
--- a/social/backends/exacttarget.py
+++ b/social/backends/exacttarget.py
@@ -74,7 +74,7 @@ class ExactTargetOAuth2(BaseOAuth2):
raise AuthFailed(self, 'Authentication Failed')
return self.do_auth(token, *args, **kwargs)
- def extra_data(self, user, uid, response, details):
+ def extra_data(self, user, uid, response, details=None, *args, **kwargs):
"""Load extra details from the JWT token"""
data = {
'id': details.get('id'),
diff --git a/social/backends/oauth.py b/social/backends/oauth.py
index 0fa17cc..d05b4ee 100644
--- a/social/backends/oauth.py
+++ b/social/backends/oauth.py
@@ -36,11 +36,13 @@ class OAuthAuth(BaseAuth):
REDIRECT_STATE = False
STATE_PARAMETER = False
- def extra_data(self, user, uid, response, details=None):
+ def extra_data(self, user, uid, response, details=None, *args, **kwargs):
"""Return access_token and extra defined names to store in
extra_data field"""
- data = super(OAuthAuth, self).extra_data(user, uid, response, details)
- data['access_token'] = response.get('access_token', '')
+ data = super(OAuthAuth, self).extra_data(user, uid, response, details,
+ *args, **kwargs)
+ data['access_token'] = response.get('access_token', '') or \
+ kwargs.get('access_token')
return data
def state_token(self):
diff --git a/social/backends/odnoklassniki.py b/social/backends/odnoklassniki.py
index f639b79..89cec2d 100644
--- a/social/backends/odnoklassniki.py
+++ b/social/backends/odnoklassniki.py
@@ -49,7 +49,7 @@ class OdnoklassnikiApp(BaseAuth):
name = 'odnoklassniki-app'
ID_KEY = 'uid'
- def extra_data(self, user, uid, response, details):
+ def extra_data(self, user, uid, response, details=None, *args, **kwargs):
return dict([(key, value) for key, value in response.items()
if key in response['extra_data_list']])
diff --git a/social/backends/open_id.py b/social/backends/open_id.py
index 63babb9..3ab5252 100644
--- a/social/backends/open_id.py
+++ b/social/backends/open_id.py
@@ -114,7 +114,7 @@ class OpenIdAuth(BaseAuth):
'email': email})
return values
- def extra_data(self, user, uid, response, details):
+ def extra_data(self, user, uid, response, details=None, *args, **kwargs):
"""Return defined extra data names to store in extra_data field.
Settings will be inspected to get more values names that should be
stored on extra_data field. Setting name is created from current
@@ -129,7 +129,7 @@ class OpenIdAuth(BaseAuth):
ax_names = self.setting('AX_EXTRA_DATA')
values = self.values_from_response(response, sreg_names, ax_names)
from_details = super(OpenIdAuth, self).extra_data(
- user, uid, {}, details
+ user, uid, {}, details, *args, **kwargs
)
values.update(from_details)
return values
diff --git a/social/backends/persona.py b/social/backends/persona.py
index 054ea2f..3c288e4 100644
--- a/social/backends/persona.py
+++ b/social/backends/persona.py
@@ -29,7 +29,7 @@ class PersonaAuth(BaseAuth):
'first_name': '',
'last_name': ''}
- def extra_data(self, user, uid, response, details):
+ def extra_data(self, user, uid, response, details=None, *args, **kwargs):
"""Return users extra data"""
return {'audience': response['audience'],
'issuer': response['issuer']}
diff --git a/social/backends/pocket.py b/social/backends/pocket.py
index 0852d31..bb48b71 100644
--- a/social/backends/pocket.py
+++ b/social/backends/pocket.py
@@ -21,7 +21,7 @@ class PocketAuth(BaseAuth):
def get_user_details(self, response):
return {'username': response['username']}
- def extra_data(self, user, uid, response, details):
+ def extra_data(self, user, uid, response, details=None, *args, **kwargs):
return response
def auth_url(self):
diff --git a/social/backends/shopify.py b/social/backends/shopify.py
index 214fd18..35bca80 100644
--- a/social/backends/shopify.py
+++ b/social/backends/shopify.py
@@ -36,11 +36,11 @@ class ShopifyOAuth2(BaseOAuth2):
)
}
- def extra_data(self, user, uid, response, details=None):
+ def extra_data(self, user, uid, response, details=None, *args, **kwargs):
"""Return access_token and extra defined names to store in
extra_data field"""
data = super(ShopifyOAuth2, self).extra_data(user, uid, response,
- details)
+ details, *args, **kwargs)
session = self.shopifyAPI.Session(self.data.get('shop').strip())
# Get, and store the permanent token
token = session.request_token(data['access_token'].dicts[1])
diff --git a/social/pipeline/social_auth.py b/social/pipeline/social_auth.py
index b790870..87895ec 100644
--- a/social/pipeline/social_auth.py
+++ b/social/pipeline/social_auth.py
@@ -83,5 +83,6 @@ def load_extra_data(backend, details, response, uid, user, *args, **kwargs):
social = kwargs.get('social') or \
backend.strategy.storage.user.get_social_auth(backend.name, uid)
if social:
- extra_data = backend.extra_data(user, uid, response, details)
+ extra_data = backend.extra_data(user, uid, response, details,
+ *args, **kwargs)
social.set_extra_data(extra_data)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-social-auth.git
More information about the Python-modules-commits
mailing list