[Zope-CMF] Re: Class attribute NOT persisting ????
Maik Jablonski
maik.jablonski at uni-bielefeld.de
Tue Nov 4 18:40:34 EST 2003
Jean-Francois.Doyon at CCRS.NRCan.gc.ca wrote:
> def manage_references_edit(self, topicname, references):
> self.topicreferences[topicname] = references
>
> Then of course more methods that actually make use of said attribute of
> interest "topicreferences"
>
> My problem: The "topicreferences" attribute does NOT persist in the ZODB !!
> Every time I restart Zope, I loose the contents of that attribute! I checked
> an XML export of the tool instance, and the topicreferences dictionary is
> indeed there, but empty.
Please read the Zope-Developers-Guide before starting to develop
Zope-products. The ZODB-Persistence-Machinery needs to be informed about
your changes in a dictionary.
Something like
def manage_references_edit(self, topicname, references):
self.topicreferences[topicname] = references
# Self-assigning informs the ZODB to make the
# whole object persistent
self.topicreferences = self.topicreferences
should do the trick.
-mj
More information about the Zope-CMF
mailing list