|
Glenn A. Hochberg
gah at research.att.com
Wed Apr 28 14:50:55 EST 2004
Sounds to me like the problem is that your class is not "known" to the
unpickling code. You could try making it a separate module (say
MyClass.py) in your pythonpath and refer to it that way:
session['inst'] = MyClass.MyClass()
-Glenn
Ted Skolnick wrote:
>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
>
>
|