[Persistence-sig] "Straw Baby" Persistence API

Jeremy Hylton jeremy@alum.mit.edu
Mon, 22 Jul 2002 16:49:51 -0400


>>>>> "TP" == Tim Peters <tim@zope.com> writes:

  TP> [Guido]
  >> I've often thought that it's ugly that you have to set _p_state
  >> and _p_changed, rather than do these things with method calls.
  >> What do you think about that?  Especially the conventions for
  >> _p_state look confusing to me.

  TP> [Jeremy Hylton]
  >> I would like to keep a simplified version of _p_changed,

  TP> If _p_changed is a 1-bit flag now, how much simpler can it get
  TP> <wink>?

It's not a one-bit flag, and that's the part I want to simplify.  You
can also:

 - set _p_changed to None, which requests that the object become a
   ghost.

 - delete the _p_changed attribute (del obj._p_changed) which also
   asks the object to become a ghost, but in subtly different ways
   than just setting the attribute to None.

 - revive a ghost, although I'm not entirely clear how this work.

The Zope3 persistence mechanism supports all the _p_changed magic, but
also exports _p_activate() and _p_deactivate().  The first makes a
ghost a real object, the second makes a real object a ghost.

Jeremy