[Zope] How to do...
dieter at handshake.de
Wed Oct 18 14:23:05 EDT 2006
Garito wrote at 2006-10-18 16:15 +0200:
>How can I control the way an attribute of a product is readed?
A "product" is an extension mechanism for Zope. Usually, a
"product" does not have attributes (you are interested in).
But inside your product you may have defined classes
instances of which you place into the Zope hierarchy
speaks about site building objects).
The standard Python way to access their attributes ("__getattr__"
and "__getattribute__") will work but has caveats: It is *very* easy
to create infinite loops with it and their "self" with not be
The Zope specific safer way is to implement "__bobo_traverse__".
Both the publisher as well as "[un]restrictedTraverse" (which
is internally used by TALES path expressions) use "__bobo_traverse__"
when defined. However, Python's "getattr" will not use it.
More information about the Zope