[Zope3-Users] Disappearing dictionary. Upon restart, dictionary resets.

Chris Withers chris at simplistix.co.uk
Mon Sep 26 05:58:57 EDT 2005


Alec Munro wrote:
> class SomeObj:
>     some_dictionary = PersistentDict({})

ouch, never use mutables for class attributes, for exactly the reasons 
you've found.

two points:

1. the dict will get newly created every time this code runs, ie: each 
time Zope starts.

2. the object is never "seated" into the ZODB. It's an attribute of the 
class, not any instance of the class, and it's only instances of the 
class that are persisted by zodb.

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope3-users mailing list