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

Alec Munro alecmunro at gmail.com
Mon Sep 26 00:07:12 EDT 2005


Well, I narrowed it down a little bit more.

I've been initializing the dictionary in the class declaration, like
the following:

class SomeObj:
    some_dictionary = PersistentDict({})

Now, for some reason, each time Zope was started, it called this, and
whenever I tried to access the some_dictionary propery on any of my
objects, it returned the newly created one. Is this what should be
happening?

Alec

On 9/26/05, Alec Munro <alecmunro at gmail.com> wrote:
> I've tried it with PersistentDicts and PersistentMappings, and no luck.
> It's very odd, I think there must be some fundamental step towards the
> use of a mapping in Zope that I'm missing.
>
> Alec
>
> On 9/21/05, Lennart Regebro <regebro at gmail.com> wrote:
> > On 9/20/05, Alec Munro <alecmunro at gmail.com> wrote:
> > > I have a content component that has a property that is a dictionary,
> > > the keys of which are objects (content components themselves). The
> > > values are lists of strings. I've tried implementing this a couple
> > > different ways, but each time I restart, the dictionary comes up
> > > empty.
> >
> > You need to use a PersistentDictionary. Ordinary dictionaries do not
> > detect that they have changed, and so do not get written to the ZODB.
> >
> > --
> > Lennart Regebro, Nuxeo     http://www.nuxeo.com/
> > CPS Content Management     http://www.cps-project.org/
> >
>


More information about the Zope3-users mailing list