[Zope-Coders] new getattr behaviour in Python 2.2b1 breaks traversal code

Steve Alexander steve@cat-box.net
Mon, 12 Nov 2001 06:23:57 +0000


Steve Alexander wrote:

> 
> In that case, I'd like to apply my patch to HTTPRequest.py.
> 
> The patch does not break backwards compatibility. It allows __getitem__ 
> and __getattr__ to each raise appropriate exceptions, while maintaining 
> the shared method body. The only down side is one extra method call when 
> calling __getattr__.
> 
> Any objections to me checking this into the trunk?


I have one objection.

I've grepped the Zope code for __getattr__, and 
ZPublisher/BaseRequest.py has the same problem of __getattr__ raising a 
KeyError rather than an AttributeError.

I should patch that in the same way as HTTPRequest.py.


-- 
Steve Alexander