You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2014/07/25 21:22:16 UTC
[13/13] git commit: [#7451] add comments
[#7451] add comments
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/84b1a1a4
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/84b1a1a4
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/84b1a1a4
Branch: refs/heads/master
Commit: 84b1a1a46a8e737d0f71c6a673c68c0ccc435f67
Parents: 9f8a0d6
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Fri Jul 25 19:21:30 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Jul 25 19:21:30 2014 +0000
----------------------------------------------------------------------
Allura/allura/lib/custom_middleware.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/84b1a1a4/Allura/allura/lib/custom_middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py
index 656e9a4..45c2141 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -284,7 +284,7 @@ class AlluraTimerMiddleware(TimerMiddleware):
class RememberLoginMiddleware(object):
- '''Modified version of beaker's SessionMiddleware.
+ '''
This middleware changes session's cookie expiration time according to login_expires
session variable'''
@@ -295,14 +295,18 @@ class RememberLoginMiddleware(object):
def __call__(self, environ, start_response):
def remember_login_start_response(status, headers, exc_info=None):
- session = environ.get('beaker.session')
+ session = environ['beaker.session']
userid = session.get('userid')
login_expires = session.get('login_expires')
if userid and login_expires is not None:
if login_expires is True:
+ # no specific expiration, lasts for duration of "browser session"
session.cookie[session.key]['expires'] = ''
else:
+ # set it to the given date
session._set_cookie_expires(login_expires)
+ # Replace the cookie header that SessionMiddleware set
+ # with one that has the new expires parameter value
cookie = session.cookie[session.key].output(header='')
for i in range(len(headers)):
header, contents = headers[i]