Recently we introduced the pickling of sessions to disk, which in general
is a good thing.
However, the ListBox example has problems now because it defines an Item
class and puts Item instances in the Session. This example is so simple, I
could probably do away with the class, but the point is that I don't want
to. Someone is going to want to put user-defined objects in sessions and
I'd like this to work.
Here's the problem:
Traceback (innermost last):
File ".\Application.py", line 270, in dispatchRequest
elif self.isSessionIdProblematic(request):
File ".\Application.py", line 334, in isSessionIdProblematic
if (time()-request.session().lastAccessTime()) >=
self.setting('SessionTimeout')*60:
File "HTTPRequest.py", line 155, in session
return self._transaction.session()
File ".\Transaction.py", line 56, in session
self._session = self._application.createSessionForTransaction(self)
File ".\Application.py", line 556, in createSessionForTransaction
session = self.session(sessId)
File ".\Application.py", line 406, in session
return self._sessions[sessionId]
File ".\SessionFileStore.py", line 46, in __getitem__
item = self.decoder()(file)
SystemError: Failed to import class Item from module __main__
My first attempt was to modify Examples/__init__.py to put Item in the
Application module (because it looks like the top level module in the trace
above) and in SessionFileStore (I was reaching there; it's the last module
on the stack). I also tried AppServer (more reaching).
None of these work and poking around with dir() I don't see that I have any
kind of handle to a __main__.
I'm stumped right now...any thoughts?
-Chuck
|