[Python-au] help debugging cacheability.py
Mark Nottingham
mnot at mnot.net
Thu Jul 21 16:30:21 CEST 2005
Ah, lovely - thanks for that. I've been putting off fixing bugs in
cachability.py for a while, as I'm rewriting a lot of the HTTP
underpinnings, but I might do a quick point release just to fix that.
Cheers,
On 20/07/2005, at 6:08 AM, Anthony Baxter wrote:
> On Wednesday 20 July 2005 22:32, Andrew McNamara wrote:
>
>> def __getattr__(self, attr):
>> if attr[0] == '_':
>> raise AttributeError
>> attr = lower(replace(attr, '_', '-'))
>> return self.data[attr]
>>
>
> Better yet would be
>
> def __getattr__(self, attr):
> if attr.startswith('__') and attr.endswith('__'):
> raise AttributeError(attr)
> attr = lower(replace(attr, '_', '-'))
> return self.data[attr]
>
>
>> I haven't verified it, but I imagine Python 1.5's hasattr() caught
>> any
>> exception and treated it as a missing attribute, rather than
>> selectively
>> catching AttributeError (I seem to remember some discussion of
>> this on
>> python-dev in the mists of time).
>>
>
> Yep. This bug was a pain in the arse, and I'm glad it's dead.
>
> --
> Anthony Baxter <anthony at interlink.com.au>
> It's never too late to have a happy childhood.
>
> _______________________________________________
> python-au maillist - python-au at starship.python.net
> http://starship.python.net/mailman/listinfo/python-au
>
>
--
Mark Nottingham http://www.mnot.net/
More information about the python-au
mailing list