changeset 3750:d5b786be06d7

make anonymous_session_lifetime a proper setting
author Johannes Berg <johannes AT sipsolutions DOT net>
date Sun, 22 Jun 2008 01:01:05 +0200
parents b0d5f7f41d4b
children 507867abcc19
files MoinMoin/config/multiconfig.py MoinMoin/session.py
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/config/multiconfig.py	Sun Jun 22 00:58:06 2008 +0200
+++ b/MoinMoin/config/multiconfig.py	Sun Jun 22 01:01:05 2008 +0200
@@ -636,6 +636,8 @@
     ('cookie_domain', None, None),
     ('cookie_path', None, None),
     ('cookie_lifetime', 12, None),
+    ('anonymous_session_lifetime', None,
+     'Session lifetime of users who are not logged in.'),
   )),
 
   'various': ('Various', None, (
--- a/MoinMoin/session.py	Sun Jun 22 00:58:06 2008 +0200
+++ b/MoinMoin/session.py	Sun Jun 22 01:01:05 2008 +0200
@@ -347,7 +347,7 @@
 
 
 def _get_anon_session_lifetime(request):
-    if hasattr(request.cfg, 'anonymous_session_lifetime'):
+    if request.cfg.anonymous_session_lifetime:
         return request.cfg.anonymous_session_lifetime * 3600
     return 0
 
@@ -407,12 +407,12 @@
                             if user_obj:
                                 sessiondata.is_stored = True
             else:
-                store = hasattr(request.cfg, 'anonymous_session_lifetime')
+                store = not (not request.cfg.anonymous_session_lifetime)
                 sessiondata.is_stored = store
         else:
             session_name = session_id_handler.generate_new_id(request)
             logging.debug("starting session (new session_name %r)" % session_name)
-            store = hasattr(request.cfg, 'anonymous_session_lifetime')
+            store = not (not request.cfg.anonymous_session_lifetime)
             sessiondata = self.dataclass(request, session_name)
             sessiondata.is_new = True
             sessiondata.is_stored = store