[Python-modules-commits] [python-social-auth] 50/61: Support Pyramid Authentication Policies

Wolfgang Borgert debacle at moszumanska.debian.org
Sat Dec 24 15:14:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to tag v0.2.13
in repository python-social-auth.

commit 0a2b9f79972868a8250591659db1f30b7761dec5
Author: Chun-Jung Lee <github.tsod at tsod.idv.tw>
Date:   Sat Aug 15 06:16:30 2015 +0800

    Support Pyramid Authentication Policies
---
 social/strategies/pyramid_strategy.py | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/social/strategies/pyramid_strategy.py b/social/strategies/pyramid_strategy.py
index 57d8c38..6ac4157 100644
--- a/social/strategies/pyramid_strategy.py
+++ b/social/strategies/pyramid_strategy.py
@@ -25,7 +25,12 @@ class PyramidStrategy(BaseStrategy):
 
     def redirect(self, url):
         """Return a response redirect to the given URL"""
-        return HTTPFound(location=url)
+        response = getattr(self.request, 'response', None)
+        if response is None:
+            response = HTTPFound(location=url)
+        else:
+            response = HTTPFound(location=url, headers=response.headers)
+        return response
 
     def get_setting(self, name):
         """Return value for given setting name"""
@@ -33,7 +38,13 @@ class PyramidStrategy(BaseStrategy):
 
     def html(self, content):
         """Return HTTP response with given content"""
-        return Response(body=content)
+        response = getattr(self.request, 'response', None)
+        if response is None:
+            response = Response(body=content)
+        else:
+            response = self.request.response
+            response.body = content
+        return response
 
     def request_data(self, merge=True):
         """Return current request data (POST or GET)"""

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