From 332442f2dafa5a4420e2b06fec3544dff7fa4bbf Mon Sep 17 00:00:00 2001 From: Allan Saddi Date: Wed, 2 Aug 2006 18:04:04 +0000 Subject: Add cookieExpiration keyword to SessionService / SessionMiddleware to adjust the session cookie's expiration. --- ChangeLog | 6 ++++++ flup/middleware/session.py | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5361be4..9385114 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-08-02 Allan Saddi + + * Add cookieExpiration keyword to SessionService / + SessionMiddleware to adjust the session cookie's expiration. + Thanks to Blaise Laflamme for the suggestion. + 2006-06-27 Allan Saddi * Set close-on-exec flag on all server sockets. Thanks to diff --git a/flup/middleware/session.py b/flup/middleware/session.py index 93f5ffc..3f1dddd 100644 --- a/flup/middleware/session.py +++ b/flup/middleware/session.py @@ -1,4 +1,4 @@ -# Copyright (c) 2005 Allan Saddi +# Copyright (c) 2005, 2006 Allan Saddi # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -543,9 +543,11 @@ class SessionService(object): def __init__(self, store, environ, cookieName='_SID_', + cookieExpiration=None, fieldName='_SID_'): self._store = store self._cookieName = cookieName + self._cookieExpiration = None self._fieldName = fieldName self._session = None @@ -621,6 +623,8 @@ class SessionService(object): name = self._cookieName C[name] = sessId C[name]['path'] = '/' + if self._cookieExpiration is not None: + C[name]['expires'] = self._cookieExpiration if expireCookie: # Expire cookie C[name]['expires'] = -365*24*60*60 -- cgit v1.2.1