[ZODB-Dev] Re: Why does this useage of __setstate__ fail?

Tres Seaver tseaver at palladion.com
Thu Jan 17 01:30:31 EST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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".


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHjvYH+gerLs4ltQ4RAl59AJ0f808PqemiqOyOp+jaNVUvIbkvVQCfcpxw
KnvNkdn/+nD5N14iadB9PUo=
=cm0X
-----END PGP SIGNATURE-----



More information about the ZODB-Dev mailing list