[mod_python] PSP: storing my class instance in session

Ted Skolnick skolnit at mail.rockefeller.edu
Wed Apr 28 11:51:35 EST 2004

I am using PSP and would like to store classes that I define in the
session.  I can store dictionaries and other stuff, but when I try to
store an instance of my class it fails to unpickle, since it doesn't
know the class I guess.

Note: first load of page is ok, setting the session, but second load of
page fails when unpickling.

sample code:
class MyClass:

session['inst'] = MyClass()


  File "/usr/lib/python2.2/site-packages/mod_python/Session.py", line
318, in do_load
    return cPickle.loads(dbm[self._sid])

AttributeError: 'module' object has no attribute 'MyClass'

Anyone have any ideas?  


More information about the Mod_python mailing list