[Zope] overloading getattr on a product

Christopher N. Deckard cnd@ecn.purdue.edu
Thu, 15 Aug 2002 14:29:20 -0400


Hello,
I'm writing a product which stores the equivalent
of Folder properties in XML.  Now I want to be
able to catalog objects of this type, but looking
at how that's done by the ZCatalog shows that
getattr(object, index) is called for all indexes.  

How do I overload getattr to parse my XML and
return the value of the "property".

My product is subclassed from ParsedXML and uses
the DOM to go through the tree and find my
"properties".  What seems to be happening is that
when I define a new __getattr__, implicit getattr
calls are made to the DOM object and it ends up
calling my newly defined getattr method.  This
sort of send it into a recursive neverending loop.

-Chris