Skip to content

Commit

Permalink
Support Pyramid Authentication Policies
Browse files Browse the repository at this point in the history
  • Loading branch information
cjltsod committed Aug 14, 2015
1 parent a2f14d1 commit 0a2b9f7
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions social/strategies/pyramid_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,26 @@ def __init__(self, storage, request, tpl=None):

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"""
return self.request.registry.settings[name]

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)"""
Expand Down

0 comments on commit 0a2b9f7

Please sign in to comment.