automatic (un-)pickling / overwriting self

Clemens Hermann haribeau at gmx.de
Fri Mar 7 16:11:40 CET 2003


Hi,

while working on a cgi-admin interface i got a little problem with
pickle.
I use a hierarchical class structure to keep users, permissions, etc.
As the amount of data is quite small i just pickle the top class
instance that references the rest.
I am looking for a way to automatically pickle the top class whenever
one of the referenced object changes. Furthermore I want a class
instance to unpickle the data automatically on creation.
A self = unpickledObject in __init__ does not work (probably a bad
idea anyway :).
So how is automatic/implicite serialization(on changes) and
de-derialization(in __init__) from *within* a class instance done?
Furthermore: How can I make sure that there can only be one instance
of the top class active at a time?

thanks in advance for any hint, rtfm, link, etc.

/clemens




More information about the Python-list mailing list