[Zope-dev] How to override __getattr__ and not break acquisition
John Barratt
jjb@vivitec.com.au
Fri, 18 Oct 2002 00:29:00 +1000
> There is no "default" or "normal" __getattr__. __getattr__ is defined only
> when you need "abnormal" ways of getting an attribute.
Do you mean it only gets defined when standard (instance & class based)
searching methods fail?
> > If I try a similar thing to this, I always end up getting the 'old' one
> > being defined as just the 'raise' statement.
>
> Thats because ObjectManager doesn't have a __getattr__ . The good
> thing with
Object Manager doesn't specifically, but Implicit does, you can see it
if you print out its '__class__.__dict__'.
> this is that you don't have to bother about calling the normal __getattr__.
> You only need to implement __getattr__ if you want data that isn't
> attributes and has names that are only defined in runtime, to look like they
> are attributes.
Exactly what I need! :-) Thankfully these methods that I need defined
at runtime only come from one other object, so it appears I can override
the __of__ method to work the magic for me in conjunction with
containment acquisition.
Thanks,
JB.