[mod_python] PSP: storing my class instance in session

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


Hi,
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:
	pass	

session['inst'] = MyClass()
%>



error:

  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?  

thanks,
Ted




More information about the Mod_python mailing list