[Python-modules-commits] [python-social-auth] 213/322: Add backward compatibility on django app initialization. Refs #550
Wolfgang Borgert
debacle at moszumanska.debian.org
Sat Dec 24 15:13:10 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 af16a6d2d795c1ef472193db60dad00f4b5327cf
Author: Matías Aguirre <matiasaguirre at gmail.com>
Date: Thu Apr 2 18:26:16 2015 -0300
Add backward compatibility on django app initialization. Refs #550
---
social/apps/django_app/__init__.py | 9 +++++++++
social/apps/django_app/default/config.py | 5 +++--
social/apps/django_app/me/__init__.py | 2 ++
social/apps/django_app/{default => me}/config.py | 7 ++++---
4 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/social/apps/django_app/__init__.py b/social/apps/django_app/__init__.py
index 6ed7e2c..217d3ce 100644
--- a/social/apps/django_app/__init__.py
+++ b/social/apps/django_app/__init__.py
@@ -10,3 +10,12 @@ To use this:
SOCIAL_AUTH_STRATEGY = 'social.strategies.django_strategy.DjangoStrategy'
SOCIAL_AUTH_STORAGE = 'social.apps.django_app.default.models.DjangoStorage'
"""
+import django
+
+
+if django.VERSION[0] == 1 and django.VERSION[1] < 7:
+ from social.strategies.utils import set_current_strategy_getter
+ from social.apps.django_app.utils import load_strategy
+ # Set strategy loader method to workaround current strategy getter needed on
+ # get_user() method on authentication backends when working with Django
+ set_current_strategy_getter(load_strategy)
diff --git a/social/apps/django_app/default/config.py b/social/apps/django_app/default/config.py
index 9658c57..745e24d 100644
--- a/social/apps/django_app/default/config.py
+++ b/social/apps/django_app/default/config.py
@@ -8,6 +8,7 @@ class PythonSocialAuthConfig(AppConfig):
def ready(self):
from social.strategies.utils import set_current_strategy_getter
from social.apps.django_app.utils import load_strategy
+ # Set strategy loader method to workaround current strategy getter
+ # needed on get_user() method on authentication backends when working
+ # with Django
set_current_strategy_getter(load_strategy)
-
-
diff --git a/social/apps/django_app/me/__init__.py b/social/apps/django_app/me/__init__.py
index 0ba8d18..9bc91e2 100644
--- a/social/apps/django_app/me/__init__.py
+++ b/social/apps/django_app/me/__init__.py
@@ -5,3 +5,5 @@ To enable this app:
* Add 'social.apps.django_app.me' to INSTALLED_APPS
* In urls.py include url('', include('social.apps.django_app.urls'))
"""
+default_app_config = \
+ 'social.apps.django_app.me.config.PythonSocialAuthConfig'
diff --git a/social/apps/django_app/default/config.py b/social/apps/django_app/me/config.py
similarity index 60%
copy from social/apps/django_app/default/config.py
copy to social/apps/django_app/me/config.py
index 9658c57..1ece281 100644
--- a/social/apps/django_app/default/config.py
+++ b/social/apps/django_app/me/config.py
@@ -2,12 +2,13 @@ from django.apps import AppConfig
class PythonSocialAuthConfig(AppConfig):
- name = 'social.apps.django_app.default'
+ name = 'social.apps.django_app.me'
verbose_name = 'Python Social Auth'
def ready(self):
from social.strategies.utils import set_current_strategy_getter
from social.apps.django_app.utils import load_strategy
+ # Set strategy loader method to workaround current strategy getter
+ # needed on get_user() method on authentication backends when working
+ # with Django
set_current_strategy_getter(load_strategy)
-
-
--
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