Terry Jones wrote at 2007-1-12 20:58 +0100:
>I have a top-level class (call it ABC) that I only ever want one instance
>of. In __init__ of that class, it uses a couple of _v_ attributes to open a
>ZODB store and get the root dictionary. If the root is empty it puts a few
>things into it. It then uses setattr to set some attributes of self to
>the things in the ZODB root. Then it just acts like any other Python class.
>Is that normal?
It sounds a bit strange:
When the "class" (more precisely, its singleton instance)
opens a ZODB store (assuming it is the only one), then
this instance is apparently not persistent (from what
"ZODB store" should it come). But when it is not persistent,
"_v_" attributes are just normal attributes.
For more information about ZODB, see the ZODB Wiki:
ZODB-Dev mailing list - ZODB-Dev@zope.org