[Zope-dev] Query on ZODB handling of class variables

Bob Weiner bob@deepware.com
Fri, 13 Apr 2001 14:14:43 -0700 (PDT)


Hi all:

I'm doing some prototyping using the standalone version of ZODB from AMK (March 30, 2001 release, the latest).  Things generally work as AMK has documented
them but one issue has cropped up on which I could use your feedback.  My reading of the ZODB code is that it uses pickling to store objects and the Python documentation on pickles say that classes are not pickled, only their names are.  I have a counter class which inherits from Persistent and contains a class attribute which needs to be persistent but seems to be the only thing in my system not restored when I reload my ZODB instance (and this jives with the pickle documentation). (If it matters, this class has an __getinitargs__
method but now __getstate__ or __setstate__ methods.)

So how does one get class attributes (one attribute instance per class)
stored into and restored from ZODB?  If this is not automatic, it would
seem that a __getclassargs__ type method might be required.  Or am I just
doing something wrong?

Also, if there is any documentation on how to debug ZODB sessions (I know there
are debugging conditionals built in but I haven't found any documentation.), I could use a pointer.

Thanks,

Bob