[ZODB-Dev] Re: zodb does not save transaction

Jean Jordaan jean.jordaan at gmail.com
Thu May 29 23:47:58 EDT 2008


'lo Tom

> you have a persistent object (inherits from persistent.Persistent) pobj
>
>>>> pobj.dict = {}
>>>> transaction.commit()
>>>> pobj.dict['foo'] = 'bar'
>>>> transaction.commit()
>>>> print pobj.dict
> {'foo': 'bar'}

The thing to note here is that {} is NOT a persistent object, and it
is the one being changed.

> Or use a persistence aware replacement.
>
>>>> from persistent.mapping import PersistentMapping
>>>> pobj.dict = PersistentMapping()

This replaces the {} with a subclass of PersistentMapping.

Now do you see what you're missing?

-- 
jean . .. .... //\\\oo///\\


More information about the ZODB-Dev mailing list