[Python-modules-commits] [python-social-auth] 238/322: Fix get_scope() override example

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Dec 24 15:13:14 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 934f159e2923ed263044fe5f09ddfd7af9da56d3
Author: Matías Aguirre <matiasaguirre at gmail.com>
Date:   Tue Apr 7 19:48:39 2015 -0300

    Fix get_scope() override example
---
 docs/use_cases.rst | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/docs/use_cases.rst b/docs/use_cases.rst
index ac12fa2..e1ef0a7 100644
--- a/docs/use_cases.rst
+++ b/docs/use_cases.rst
@@ -163,7 +163,7 @@ accomplish that behavior, there are two ways to do it.
         def get_scope(self):
             scope = super(CustomFacebookOAuth2, self).get_scope()
             if self.data.get('extrascope'):
-                scope += [('foo', 'bar')]
+                scope = scope + [('foo', 'bar')]
             return scope
 
 
@@ -175,6 +175,19 @@ accomplish that behavior, there are two ways to do it.
    Put this new backend in some place in your project and replace the original
    ``FacebookOAuth2`` in ``AUTHENTICATION_BACKENDS`` with this new version.
 
+   When overriding this method, take into account that the default output the
+   base class for ``get_scope()`` is the raw value from the settings (whatever
+   they are defined), doing this will actually update the value in your
+   settings for all the users::
+
+    scope = super(CustomFacebookOAuth2, self).get_scope()
+    scope += ['foo', 'bar']
+
+   Instead do it like this::
+
+    scope = super(CustomFacebookOAuth2, self).get_scope()
+    scope = scope + ['foo', 'bar']
+
 2. It's possible to do the same by defining a second backend which extends from
    the original but overrides the name, this will imply new URLs and also new
    settings for the new backend (since the name is used to build the 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