summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1ef3649)
raw | patch | inline | side by side (parent: 1ef3649)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 26 Feb 2004 04:15:04 +0000 (04:15 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 26 Feb 2004 04:15:04 +0000 (04:15 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2122 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/backends/sessions.py | patch | blob | history |
index 60a17960db168cecd8f780502f82b02d104be408..a0f3f50df3e736f7bd60cb114f36d859b3e239e8 100644 (file)
-#$Id: sessions.py,v 1.8 2004-02-19 02:39:05 richard Exp $
+#$Id: sessions.py,v 1.9 2004-02-26 04:15:04 richard Exp $
"""This module defines a very basic store that's used by the CGI interface
to store session and one-time-key information.
def commit(self):
pass
+ def updateTimestamp(self, sessid):
+ self.set(sessid, **{self.timestamp: time.time()})
+
+ def clean(self, now):
+ """Age sessions, remove when they haven't been used for a week.
+ """
+ week = 60*60*24*7
+ for sessid in self.list():
+ interval = now - self.get(sessid, self.timestamp)
+ if interval > week:
+ self.destroy(sessid)
+
class Sessions(BasicDatabase):
name = 'sessions'
+ timestamp = 'last_use'
class OneTimeKeys(BasicDatabase):
name = 'otks'
+ timestamp = '__time'