[Zope-dev] __getattr__ and Acquisition

Andreas Kostyrka andreas@kostyrka.priv.at
25 Sep 2002 08:21:53 +0200


Am Die, 2002-09-24 um 21.32 schrieb Dieter Maurer:
> Andreas Kostyrka writes:
>  > ...
>  > > __of__ is non-intuitive but it can work.
>  > So how do I call it?
>  > return myitem.__of__(self)
>  > Doesn't make sense, as self is not wrapped and as such DOES not contain
>  > any knowledge how it was accessed, ...
> Acquisition lookup is implemented by a recursive function:
> 
>   While you are right that "self" does not know how it was accessed,
>   the recursive lookup function does (on its runtime stack).
And how do I return an attribute that is acquired (but not down th main
acquisition path, but on a side line?)
I assume that I could probably play some silly games with __of__ to make
my additional Acquisition objects to come just before my object in the
acquisition path, ...
But still it seems to me, it could be nice if __getattr__ would be
called on an explicit wrapper of self, instead of the direct pure self.

Andreas
-- 
Andreas Kostyrka <andreas@kostyrka.priv.at>