dharana wrote:
I wonder if _dbschema, which is a class attribute, is the problem?
Quoting from the python documentation for pickle
(http://www.python.org/doc/2.3.5/lib/node65.html)
Yes, it is a class attribute.
"""Similarly, classes are pickled by named reference, so the same
restrictions in the unpickling environment apply. Note that none of
the class's code or data is pickled, so in the following example the
class attribute attr is not restored in the unpickling environment:
Uarg.
class Foo:
attr = 'a class attr'
picklestring = pickle.dumps(Foo)
"""
I haven't tried any tests within mod_python, but its a good place to
start.
But I get the segfault on the req.sess.save() line before unpickling
anything (Unless mp reloads the session after saving me, correct me if
I'm wrong). Trying to save() the dreaded object is what is causing the
segfault.
I'm a little unclear what you are saying here. Session.FileSession()
unpickles the session object from the session file (if the session is
valid), and save() pickles the session object and saves the pickle to
the session file.
Also if the class attribute isn't found it should raise an Exception on
my function?
No. The class attribute will be read from the class definition. So if
you modify your class attribute _dbschema in your code, your changes
will be lost when the instance is saved.
> Just to clear any doubts, the class works correctly when it's not in
relation to the session. As I said previously I got around this
particular segfault by storing just the website_id.
Have you tried creating a pickle of your DynWebsite object?
Regards,
Jim