Hi Chuck,
on 08/23/2000 05:03:11 you wrote:
>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__
This is a result of the fact that the Session Sweeper directly calls the
pickler which only saves the part of the session up to the point where
it comes across an unpickleable object.
Appserver then chokes on loading the truncated session back from disk and
the defective Session file has to be deleted by hand.
Although your mail is already one year old, this problem is still valid.
I would strongly suggest to encapsulate calls to encode() in an exception
handler and either check sessions for "encodability" (any encoder class
provided would have to have a validation method for that to work, though) or
just automatically delete Sessions from disk that caused an exception while
being encoded and switch them to "memory storage only".
Would you accept a patch if I fixed it that way?
Regards,
Fionn
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/webware-devel