[Zope-dev] ZODB now supports user-defined__get/set/delattr__ methods

Martijn Faassen faassen@vet.uu.nl
Wed, 17 May 2000 12:07:09 +0200


Jim Fulton wrote:
[snip]
> The other night, I thought I wanted to use attr hooks 
> for the database mounting experiments I've been doing. 
> While thinking about it, I realized that there was 
> a simple solution.

Awesome; I might want to use these for XMLWidgets. A widget is something
that layers on top of an XML node and supplies it with extra methods,
dynamically. In fact the way it's implemented now it acquisition-voodoos
itself with __of__() *underneath* the node (in fact underneath *all* nodes,
as otherwise it'd break XMLDocument's use of acquisition to get access
to the parent node..). This is however slow and hackish and cumbersome.
I was wishing for __getattr__ then.

> I actually ended up not using the new attr support for database
> mounting. :)

Yes, I noticed you did something with __of__(). From an XMLWidgets point
of view, I'm very interested in the techniques used here. Could you explain
how it works conceptually? You seem to supply somekind of wrapper object
as well, which is what I need for the widgets.

Regards,

Martijn