[ZODB-Dev] forgetting self._p_changed

Thomas Guettler Thomas Guettler <thomas@thomas-guettler.de>
Mon, 10 Mar 2003 19:16:27 +0100


On Sun, Mar 09, 2003 at 11:57:32PM +0000, Kasper Souren wrote:
> > Second Question: I think it should be possible to change python, so it
> > marks the lists and dictionaries as changed, so that you don't need to
> > set _p_changed. I am not familiar with the details. What do you, the
> > ZODB experts think about this?
> 
> Instead of a dict you should use the PersistentMapping, it does exactly this. 
> I guess there's also a Persistent thingy acting like a list.
> 
> I'm using Standalone-ZODB and I need to do "from Persistence import 
> PersistentMapping".

But you still need to be aware, that this is a special
object. Otherwise you would could lose the persistence very easy:

import ZODB
from ZODB.PersistentList import PersistentList

mylist=PersistentList()
print type(mylist)
mylist=map(None, mylist)
print type(mylist)

==guettli@sonne:~/zope/lib/python$ python test-pl.py 
<extension class ZODB.PersistentList.PersistentList at 819f5a8>
<type 'list'>

I just want you to know, that it would be very nice if _p_changed=1
would be set automatically. But I think that this is nearly impossible
to implement.

 thomas

-- 
Thomas Guettler <guettli@thomas-guettler.de>
http://www.thomas-guettler.de