[Zope-ZEO] Recovering __setattr__

Jim Fulton jim@digicool.com
Wed, 27 Dec 2000 10:11:09 -0500


Eric Jacobs wrote:
> 
> As the documentation suggests, I removed all my __setattr__
> methods before making the classes persistent. However, I need
> to get them back. How do I do this? Alternatively, as what I
> really need is the change notification, is there a way to
> hook into ZODB's setattr implementation?

You can now (as of Zope 2.2) have user-defined __get/set/delattr__
methods. They have the same semantics as for standard Python, with the
following exception. User-defined __set/delattr__ methods must notify the
persistence machinery of object changes.  This is done by
setting self._p_changed to a true value or calling self.__changed__
with a true value.

Jim

--
Jim Fulton           mailto:jim@digicool.com   Python Powered!        
Technical Director   (888) 344-4332            http://www.python.org  
Digital Creations    http://www.digicool.com   http://www.zope.org