[ZODB-Dev] None-persistent behaviour of BTree subclasses

pm5 at matilda.fiorile.org pm5 at matilda.fiorile.org
Mon Apr 19 10:27:16 EDT 2004


On Mon, Apr 05, 2004 at 09:30:00AM +0200, Dieter Maurer wrote:
> pm5 at matilda.fiorile.org wrote at 2004-4-4 17:14 +0800:
> > ...
> >It seems that attributes of BTree subclasses are not saved. The
> >following code raises an ``AssertionError: None != 'foo''' at the
> >assertEqual line.  Descendants of Persistent (just change the definition
> >of UserDefinedClass and run) perserves this attribute correctly.
> 
> Your best bet is probably not to inherit from "BTrees" classes
> but use instead delegation (which is much more tedious but probably
> less tedious than extending the "BTrees" "__getstate__/__setstate__/
> _p_resolveConflict").

It seems UserDict and DictMixin works fine with BTrees, so
I think using delegation is acceptable.  Sorry if this is
trivial.  I've been using Python for only a couple of months.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zodb-dev/attachments/20040419/bf5543ae/attachment.bin


More information about the ZODB-Dev mailing list