|
RE: [Webware-devel] Session Pickle
From: Geoffrey Talvola <gtalvola@na...> - 2004-01-07 21:11
|
Giles Hall wrote: > Greetings, > > I found a problem with SessionDynamicStore. Here is the > MovetoMemory() function at line 132. > > def MovetoMemory(self, key): > self._lock.acquire() > try: > global debug > if debug: print ">> Moving %s to Memory" % key > self._memoryStore[key] = self._fileStore[key] > del self._fileStore[key] > finally: > self._lock.release() > > Notice how there are two calls to _memoryStore.__getitem__()? The I think you meant to say _fileStore.__getitem__ right? > first is used to acquire the session object while the second is > used to delete > the session object out of _fileStore. The consequence is that the > pickled session object will be unpickled twice, which is not only > unnecessary, but may cause hard-to-track-down logic errors. > > A possible fix would be to create a method within _fileStore > that will > both recover and delete the pickled session data. Comments? Sounds like a good idea to me. The method should be called "pop" because that's the name of the dictionary method that does the same thing. - Geoff |
| Thread | Author | Date |
|---|---|---|
| RE: [Webware-devel] Session Pickle | Geoffrey Talvola <gtalvola@na...> |