[Zope] possible bug in zope 2.4.0/2.4.3 or 2.5.x

Lennart Regebro lennart@torped.se
Sun, 31 Mar 2002 23:20:59 +0200


From: "Ollas, Marcus" <mco@loxcom.net>
> Now the problem is, that zope seems to forget the contents of the
dictionary.

Yup, that is expected behaviour. The persistance in Zope works automatically
only when setting values. When manipulating lists or dictionaries the
persistance mechanism doesn't track this, and objects does not get properly
written to disk.

>I couldn't find out, why or when this is happening. BUT: if I start the
>zope server in debug mode, everything is working fine !

I doubt that... :-)

The solution is easy: Make your dictionaries into PersistentMapping objects
instead. Instead of
    self.__items__ = {}
you write
    self.__items__ = PersistentMapping({})
(obviously you must first import it : from ZODB import PersistentMapping).

Then it should work!