_p_changed, was RE: [ZODB-Dev] Excellent overview of ODBMS andmy take on ZODB

Jim Fulton jim@zope.com
Tue, 26 Feb 2002 17:57:41 -0500


Magnus Lyck=E5 wrote:
>=20
> Hm... Of course I once read this about __setattr__ and friends,
> but I forgot...
>=20
> At 14:00 2002-02-26 +0100, Geert-Jan Van Den Bogaerde wrote:
> >"Recent versions of ZODB allow writing persistent classes that have
> >__getattr__, __delattr__, or __setattr__ methods. The one minor
> >complication is that the machinery for automatically detecting changes=
 to
> >the object is disabled while the __getattr__, __delattr__, or __setatt=
r__
> >method is executing. This means that if the object is modified, the ob=
ject
> >should be marked as dirty by setting the object's _p_changed method to
> >true."
>=20
> 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
>=20
> self._p_changed =3D 1
>=20
> in __setattr__ ? (I realize that I don't need to set it if
> the object isn't actually changed in __setattr__.)

Right, assuming that your setattr actually modifies that
object. ;)

Jim

--
Jim Fulton           mailto:jim@zope.com       Python Powered!       =20
CTO                  (888) 344-4332            http://www.python.org =20
Zope Corporation     http://www.zope.com       http://www.zope.org