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

Roch'e Compaan roche at upfrontsystems.co.za
Tue Dec 24 07:46:07 EST 2002


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.

-- 
Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za



More information about the PEAK mailing list