This makes sense with some of my experimentation.   So I am correct to assume now
that any member classes that I include into my Product that don't themselves
derive from Persistence.Persistent will become pickled into my products pickle,
and will do whenever __setattr__  method of my product is called.

I am wondering if this also answers my question in my very last email titled Re:
[Zope] persistence and dictionaries - new light .... where I found that anything
called within my manage_edit(self, title, REQUEST=None) method was persisted, but
that if I did the same things in another method(also in the Product) and called
that method from a dtmlMethod then things would not be persisted.

thanks for all the help from everyone, this is really invaluable.

Tres Seaver wrote:

> Matt <[EMAIL PROTECTED]> wrote:
> >
> > Chris, this was my original confusion .... the two places below where you say
> >
> > "You can put instances which do not inherit from Persistence.Persistent in
> > your database.  They just won't "stick".  They'll hang around until the
> > server is restarted or for an undetermined amount of time during normal
> > operations."
> >
> > "No.  It'll work for "a while" or until the server is restarted.  :-)"
> >
> > actually do persist after restarts ... that's what confused me, they wouldn't
> > go away and they should!!
> I think that the confusion here lies in the word, "Peristent".
> Because it uses the standard Python pickling mechanism, the ZODB
> can store all kinds of objects (integers, strings, etc., as well
> as class instances).  The ZODB is, however, broken up into a
> collection of individual records, each of which contains a
> series of pickles (one per transaction).  Objects which are not
> "ZODB aware" get stored in the pickle of their container (actually,
> the nearest one which *is* persistence-aware).
> Deriving your class from Persistence.Persistent says to the
> ZODB, "put me in my *own* pickle, not it the pickle of my container".
> The other thing Persistence does is hook the '__setattr__' method,
> so that changes you make to the object's attributes automatically
> register it with Zope's transaction machinery;  this registration
> means that a new pickle gets saved to the ZODB at the end of the
> transaction.  Objects which do not derive from Persistence must
> handle this registration themselves, or else risk having such
> changes be lost whenever they are reloaded.
> Globals.PersistentDictionary is a wrapper class which does does
> this kind of registration in its '__setitem__' method.
> HTH,
> Tres.
> --
> ===============================================================
> Tres Seaver                                [EMAIL PROTECTED]
> Digital Creations     "Zope Dealers"
> _______________________________________________
> Zope maillist  -  [EMAIL PROTECTED]
> **   No cross posts or HTML encoding!  **
> (Related lists -
> )

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to