[Python-modules-commits] [python-social-auth] 20/322: Rename tokens to access_token. Refs #430

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Dec 24 15:12:44 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 aad06edaa8b0fba3ee3447609e8dad2284b9a15e
Author: Matías Aguirre <matiasaguirre at gmail.com>
Date:   Sat Nov 1 23:15:18 2014 -0200

    Rename tokens to access_token. Refs #430
---
 social/storage/base.py              | 9 ++++++++-
 social/tests/backends/test_dummy.py | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/social/storage/base.py b/social/storage/base.py
index 4520a3d..fe246e9 100644
--- a/social/storage/base.py
+++ b/social/storage/base.py
@@ -3,6 +3,8 @@ import re
 import time
 import base64
 import uuid
+import warnings
+
 from datetime import datetime, timedelta
 
 import six
@@ -34,10 +36,15 @@ class UserMixin(object):
             return Backend(strategy=strategy)
 
     @property
-    def tokens(self):
+    def access_token(self):
         """Return access_token stored in extra_data or None"""
         return self.extra_data.get('access_token')
 
+    @property
+    def tokens(self):
+        warnings.warn('tokens is deprecated, use access_token instead')
+        return self.access_token
+
     def refresh_token(self, strategy, *args, **kwargs):
         token = self.extra_data.get('refresh_token') or \
                 self.extra_data.get('access_token')
diff --git a/social/tests/backends/test_dummy.py b/social/tests/backends/test_dummy.py
index 4ceab75..53ca25b 100644
--- a/social/tests/backends/test_dummy.py
+++ b/social/tests/backends/test_dummy.py
@@ -64,7 +64,7 @@ class DummyOAuth2Test(OAuth2Test):
 
     def test_tokens(self):
         user = self.do_login()
-        self.assertEqual(user.social[0].tokens, 'foobar')
+        self.assertEqual(user.social[0].access_token, 'foobar')
 
     def test_revoke_token(self):
         self.strategy.set_settings({

-- 
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