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[]
        # setstate is called subsequently
        assert hasattr(newuser, 'color')
        assert newuser.getColor() == 'blue'
        assert newuser.getColor() == 'red'

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -

Reply via email to