[Zope] overload __getattr__ in brains-class?
Dieter Maurer
dieter@handshake.de
Thu, 18 Jul 2002 21:54:40 +0200
Jo Meder writes:
> Situation: I'm developing a product where some attributes come from
> one bunch of SQL-tables and some additional info is obtained by other
> means.
>
> The idea was to create a brain-class and overwrite __getattr__ to return
> the correct values from the different sources according to what key the
> application asked for.
>
> The objects are created (just like in DA.py) via
>
> objects=Results.Results(result,brain,parent,None)
>
> Now whatever I try, either some other __getattr__ seems to be called
> since I can get none of my "simulated" attributes to show up.
It should work with modern Zope versions.
I once tried and failed with an older version (Zope 2.1.6).
My "__getattr__" led to an infinite loop.
Dieter