[Zope] Object reference and the _SetObject() method
Pavlos Christoforou
pavlos@gaaros.msrc.sunysb.edu
Tue, 19 Oct 1999 01:12:42 -0400 (EDT)
On Mon, 18 Oct 1999, Johan Carlsson wrote:
Johan -
I am not very familiar with ZODB (at least the new version) source code
but here is what I remember.
> My questions!
>
> Is this correct to do this or can I get my self
> in trouble doing direct reference in this way?
You will eventually ;-) Especially if your objects are not Zope objects
that follow the Zope management interface.
> And what does the _p_changed.
setting _p_changed notifies ZODB that the relevant object has changed
status and takes the neccessary steps to save it etc. You might need it in
situations where changes to the object are not registered automatically by
ZODB. For instance, lets suppose your object has a mutable attribute
mylist, then:
self.mylist.append(1)
will not be registered by the ZODB, whereas:
tmp=self.mylist
tmp.append(1)
self.mylist=tmp
will be registered as ZODB intercepts the __getattr__ call.
In the former case you will need to set _p_changed manually.
Pavlos