Question: do you really need to use the __setattr__ hook to track changes to the object? Is the application written in such a way that you could expose a different API? __setattr__ is special because it's provided by the persistence machinery to track object changes. Overriding it is possible, but it's slightly black-magic (it used to be impossible to override it, but that changed about a year ago or so with caveats).
If it's still desirable, you might be able to do something like this via a combination of overriding Acquisition's __of__ method, volatile attributes, and a special-purpose __setattr__ . See CMF's Skinnable.py for an example of doing this with __getattr__. ----- Original Message ----- From: "Brian Oliver" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, February 05, 2002 8:19 PM Subject: Re: [Zope-dev] aq_parent not available in __setattr__ Yep... Certainly isn't. Aquisition isn't available for either __getattr__ or __setattr__. So the fundamental question remains... How does one receive a callback/create a hook that is called when an attribute is changed, especially changed via the default property editor for Zope objects (such that aquisition still works)? If this type of feature isn't already planned for Zope 3 (I'll take a look and get active), I'm sure it should be. My suggestion would be to provide Java Beans like get and set methods for all properties, so custom handlers could easily be created. -- Brian >From: Dieter Maurer <[EMAIL PROTECTED]> >To: "Brian Oliver" <[EMAIL PROTECTED]> >CC: [EMAIL PROTECTED] >Subject: Re: [Zope-dev] aq_parent not available in __setattr__ >Date: Tue, 5 Feb 2002 23:08:13 +0100 > >Brian Oliver writes: > > ... >Share reported for "__getattr__" (--> mailing list archives) >that the self passed in is not acquisition wrapped. >Maybe, this is also the case for its companion "__setattr__"... > > >Dieter _________________________________________________________________ Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com _______________________________________________ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) _______________________________________________ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )