File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 1- #$Id: sessions.py,v 1.8 2004-02-19 02:39:05 richard Exp $
1+ #$Id: sessions.py,v 1.9 2004-02-26 04:15:04 richard Exp $
22"""This module defines a very basic store that's used by the CGI interface
33to store session and one-time-key information.
44
@@ -115,9 +115,23 @@ def opendb(self, mode):
115115 def commit (self ):
116116 pass
117117
118+ def updateTimestamp (self , sessid ):
119+ self .set (sessid , ** {self .timestamp : time .time ()})
120+
121+ def clean (self , now ):
122+ """Age sessions, remove when they haven't been used for a week.
123+ """
124+ week = 60 * 60 * 24 * 7
125+ for sessid in self .list ():
126+ interval = now - self .get (sessid , self .timestamp )
127+ if interval > week :
128+ self .destroy (sessid )
129+
118130class Sessions (BasicDatabase ):
119131 name = 'sessions'
132+ timestamp = 'last_use'
120133
121134class OneTimeKeys (BasicDatabase ):
122135 name = 'otks'
136+ timestamp = '__time'
123137
You can’t perform that action at this time.
0 commit comments