Tres Seaver wrote at 2008-1-17 01:30 -0500: > ... >Mika, David P (GE, Research) wrote: > >>> Can someone explain why the test below (test_persistence) is failing? >>> I am adding an attribute after object creation with __setstate__, but >>> I can't get the new attribute to persist. > >You are mutating the object *inside* your __setstate__: the ZODB >persistence machinery clears the '_p_changed' flag after you *exit* from >'__setstate__': the protocol is not intended to support a persistent >"write-on-read".
When I remember right, newer ZODB versions allow the "__setstate__" implementation to tell whether "_p_changed" should or should not be cleared (default: cleared). Tim Peters added this feature to support the frequent use case, that "__setstate__" is used for object migration. -- Dieter _______________________________________________ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev