[TransWarp] First attempt to use the storage package in PEAK

Phillip J. Eby pje at telecommunity.com
Tue Dec 24 14:16:07 EST 2002


At 02:46 PM 12/24/02 +0200, Roch'e Compaan wrote:
>On Tue, Dec 24, 2002 at 11:19:58AM +0200, Roch? Compaan wrote:
> > Hi Philip
> >
> > Here is my first quick attempt to use the storage package in PEAK.
> > Creating new instances work fine but loading and saving doesn't work
> > yet.  My use of the binding package is still a shot in the dark. Can you
> > maybe comment on the way I used the various parts of PEAK below:
>
>Subclassing from model.Element seems to break persistence, maybe because
>__setattr__ is bound to binding.Base.__setattr__ (line 42,48 in
>model.persistent):
>
>     class Element(DataType, Persistent):
>
>         """A (potentially persistent) domain element"""
>
>         __implements__ = IElement
>         __metaclass__  = ElementClass
>         __setattr__    = binding.Base.__setattr__
>
>The call to __setattr__ in Persistence.Persistent seems necessary to
>turn a ghost into a loaded object.
>
>If I subclass 'Contact' from Persistent everything works fine.

Good catch.  That should really be Persistent.__setattr__, and in fact the 
line itself can probably disappear.  It's a holdover from when Classifier 
was immutable.  Now there's a separate Immutable base, so the line can 
go.  A fix is in CVS now.




More information about the PEAK mailing list