[Python-modules-commits] [python-social-auth] 281/322: Make URLs trailing slash be configurable by setting. Refs #505
Wolfgang Borgert
debacle at moszumanska.debian.org
Sat Dec 24 15:13:20 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 1851b5faeaa84a6544f584719104c0b2534e79a5
Author: Matías Aguirre <matiasaguirre at gmail.com>
Date: Tue Apr 21 20:29:31 2015 -0300
Make URLs trailing slash be configurable by setting. Refs #505
---
social/apps/django_app/urls.py | 17 ++++++++++++-----
social/apps/django_app/utils.py | 3 ---
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/social/apps/django_app/urls.py b/social/apps/django_app/urls.py
index add764c..43a97aa 100644
--- a/social/apps/django_app/urls.py
+++ b/social/apps/django_app/urls.py
@@ -1,4 +1,5 @@
"""URLs module"""
+from django.conf import settings
try:
from django.conf.urls import patterns, url
except ImportError:
@@ -6,15 +7,21 @@ except ImportError:
from django.conf.urls.defaults import patterns, url
+from social.utils import setting_name
+
+
+extra = getattr(settings, setting_name('TRAILING_SLASH'), True) and '/' or ''
+
+
urlpatterns = patterns('social.apps.django_app.views',
# authentication / association
- url(r'^login/(?P<backend>[^/]+)/?$', 'auth',
+ url(r'^login/(?P<backend>[^/]+){0}$'.format(extra), 'auth',
name='begin'),
- url(r'^complete/(?P<backend>[^/]+)/?$', 'complete',
+ url(r'^complete/(?P<backend>[^/]+){0}$'.format(extra), 'complete',
name='complete'),
# disconnection
- url(r'^disconnect/(?P<backend>[^/]+)/?$', 'disconnect',
+ url(r'^disconnect/(?P<backend>[^/]+){0}$'.format(extra), 'disconnect',
name='disconnect'),
- url(r'^disconnect/(?P<backend>[^/]+)/(?P<association_id>[^/]+)/?$',
- 'disconnect', name='disconnect_individual'),
+ url(r'^disconnect/(?P<backend>[^/]+)/(?P<association_id>[^/]+){0}$'
+ .format(extra), 'disconnect', name='disconnect_individual'),
)
diff --git a/social/apps/django_app/utils.py b/social/apps/django_app/utils.py
index ae20098..b4a50ec 100644
--- a/social/apps/django_app/utils.py
+++ b/social/apps/django_app/utils.py
@@ -37,9 +37,6 @@ def psa(redirect_uri=None, load_strategy=load_strategy):
uri = redirect_uri
if uri and not uri.startswith('/'):
uri = reverse(redirect_uri, args=(backend,))
- if settings.APPEND_SLASH and not uri.endswith('/'):
- uri = uri + '/'
-
request.social_strategy = load_strategy(request)
# backward compatibility in attribute name, only if not already
# defined
--
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