_p_changed, was RE: [ZODB-Dev] Excellent overview of ODBMS and
mytake on ZODB
Jim Fulton
jim@zope.com
Wed, 27 Feb 2002 07:51:41 -0500
Jeremy Hylton wrote:
>
> > So what does this mean concretely. I don't modify
> > objects in __getattr__, and I don't override
> > __delattr__. Is it as simple as putting
> >
> > self._p_changed = 1
> >
> > in __setattr__ ? (I realize that I don't need to set it if
> > the object isn't actually changed in __setattr__.)
> >
> > Is this all I need to think about? (Well, on this issue I
> > mean.)
>
> I haven't followed the whole thread, but I think this is not right. The
> __getattr__() and __setattr__() methods in the Persistence base class
> already track access to individual attributes. The __setattr__() hook will
> set _p_changed for you.
Not if you provide your own __setattr__. The reason is that you could
have a setattr that doesn't modify the object. For example,
it might modify some other object, or even set a volitile attribute.
Jim
--
Jim Fulton mailto:jim@zope.com Python Powered!
CTO (888) 344-4332 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org