[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zodb-dev
Subject:    Re: _p_changed, was RE: [ZODB-Dev] Excellent overview of ODBMS and
From:       Jim Fulton <jim () zope ! com>
Date:       2002-02-27 12:51:41
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic