[Zope-dev] __getattr__ and Acquisition

Andreas Kostyrka andreas@kostyrka.priv.at
22 Sep 2002 23:39:52 +0200


Hi!

I've just discovered, that Acquisition does not work with __getattr__,
right?

(I assume that this is so because something like getattr(mybase,attr) is
called during the acquisition process to prevent infinite recursion.)

Anyway to get around that? (To basically get a wrapped self from
somewhere?)

I see two "solutions":
-) I let some method (like pretraversal) acquire my object and store a
reference in my object. This might work if the object is changed seldom
and the method is called regularly enough, ...
-) I walk the frame stack and extract the wrapped self from it. Not
really nice, but then Zope does a number of black magic things :)

Andreas