From: Chuck E. <ChuckEsterbrook@StockAlerts.com> - 2002-02-13 21:47:49
|
On Wednesday 13 February 2002 12:19 pm, Geoffrey Talvola wrote: > Jeff Johnson wrote: > > I've seen this a few times on my test server today: > > > > Exception in thread SessionSweeper: > > Traceback (most recent call last): > > File "/usr/local/lib/python2.2/threading.py", line 408, in > > __bootstrap > > self.run() > > File "/usr/local/lib/python2.2/threading.py", line 396, in run > > apply(self.__target, self.__args, self.__kwargs) > > File "./TaskKit/Task.py", line 55, in _run > > File "./WebKit/Tasks/SessionTask.py", line 12, in run > > File "./WebKit/SessionDynamicStore.py", line 180, in > > cleanStaleSessions > > File "./WebKit/SessionStore.py", line 106, in cleanStaleSessions > > File "./WebKit/SessionFileStore.py", line 83, in __delitem__ > > File "./WebKit/Session.py", line 84, in isExpired > > AttributeError: Session instance has no attribute '_isExpired' > > I have a theory. It looks like Chuck added a new attribute > _isExpired to the Session object in CVS recently. It gets > initialized in > Session.__init__() so you would expect that attribute to always be > there. But if you unpickle a session object from disk that was saved > _before_ you upgraded Session.py, that attribute will be missing, > because unpickling doesn't trigger __init__ to be called! > > This assumes you're using a recent CVS snapshot of Session.py, of > course. > > I think that means that this bug will go away by itself once all of > your old sessions have expired. But there should also be some way to > fix this in the Session code itself, so when it unpickles the session > it adds in the _isExpired attribute if necessary. > > - Geoff Another approach along those lines is to make isExpired() friendly towards sessions without the attribute: RCS file: /cvsroot/webware/Webware/WebKit/Session.py,v retrieving revision 1.21 diff -r1.21 Session.py 84c84 < return self._isExpired --- > return getattr(self, '_isExpired', 0) This is checked in. Give it a spin. Also, if you are subclassing Session, make sure your __init__ invokes super. -Chuck |