[Zope] Persistence issue or a simple bug?

Jens Vagelpohl jens@zope.com
Tue, 25 Jun 2002 08:21:49 -0400


when you have a persistent object that has attributes of a simple python 
type (lists, dictionaries, etc) then the persistence machinery cannot 
automatically tell that the object was changed if you manipulate these 
attributes.

to work around this and explicitly tell the persistence machinery of those 
changes your code can do one of the following:

- reassignment to the attribute in question:

	mylist = myobj.mylist
	mylist.append('hello')
	myobj.mylist = mylist

- use the magic _p_changed marker:

	myobj.mylist.append('hello')
	myobj._p_changed = 1

hth

jens


On Tuesday, June 25, 2002, at 08:12 , Pawel Lewicki wrote:

> Hello,
> I've got a problem with a persistence of created product attributes. My
> product is a simple CMF portal type containing lists of some objects. The
> problem is that my lists are flushed after refresh of the product. The
> question is if all stored elements should be persistent or just main 
> product
> instance? If not - which elements are affected during the product refresh?
>
> Pawel Lewicki
>