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

David Binger dbinger at mems-exchange.org
Thu Jan 17 13:23:04 EST 2008


You need to saved the user object with the color attribute.
The __setstate__ is just giving you the unsaved one every time.
Add 'newuser._p_changed = 1'  after the first
assert statement below and it will be saved along with
your change to the Color instance.

On Jan 17, 2008, at 11:21 AM, Mika, David P (GE, Research) wrote:

>     def test_2_setstate(self):
>         print 'in test2'
>         newuser = self.userdb[self.id]
>         # setstate is called subsequently
>         assert hasattr(newuser, 'color')
>         assert newuser.getColor() == 'blue'
>         newuser.setColor('red')
>         assert newuser.getColor() == 'red'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zodb-dev/attachments/20080117/0e326ce7/attachment.htm


More information about the ZODB-Dev mailing list