Dieter Maurer escribió:
Garito wrote at 2006-10-18 16:15 +0200:
How can I control the way an attribute of a product is readed? __getattr__? __getattribute__?

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
acquisition wrapped.

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.

Hi, Dieter!

How can I create an accessor to read (not to write) and preprocess all properties?


Mis Cosas

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to