[issue1114] changectx.__getitem__ raises LookupError instead of KeyError

Alexander Solovyov mercurial-bugs at selenic.com
Sun May 11 14:40:54 CDT 2008


New submission from Alexander Solovyov <piranha at piranha.org.ua>:

__getitem__ uses filectx method from same class, which raises LookupError
instead of KeyError. And while it makes sense for filectx, it brings some pain
and inconsistency in usage of __getitem__.

To give example where I've got trouble with that: Django's templating system,
when resolving variables like {{ cset.user }}, tries to return value from
dictionary and then (in case of KeyError/AttributionError/TypeError) tries to
get property/method. And raising LookupError instead of KeyError just breaks it.

----------
files: keyerror.patch
messages: 6024
nosy: piranha
priority: bug
status: unread
title: changectx.__getitem__ raises LookupError instead of KeyError

____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue1114>
____________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: keyerror.patch
Type: application/octet-stream
Size: 678 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20080511/2025e02a/attachment.obj 


More information about the Mercurial-devel mailing list