From 0b06609c08cbd1e1b7120f617a2261028b02dce5 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Tue, 16 Oct 2007 00:25:17 -0300 Subject: [PATCH] Bugfix: catch LookupErrors instead of IndexError in ContainerSubHandler. --- pymin/services/util.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pymin/services/util.py b/pymin/services/util.py index 2fe7f9b..9c96fca 100644 --- a/pymin/services/util.py +++ b/pymin/services/util.py @@ -703,7 +703,7 @@ class ContainerSubHandler(SubHandler): item.update(*args, **kwargs) if hasattr(item, '_update'): item._update = True - except IndexError: + except LookupError: raise ItemNotFoundError(index) @handler(u'Delete an item') @@ -718,11 +718,12 @@ class ContainerSubHandler(SubHandler): else: del self._attr()[index] return item - except IndexError: + except LookupError: raise ItemNotFoundError(index) @handler(u'Remove all items (use with care).') def clear(self): + r"clear() -> None :: Delete all items of the container." if isinstance(self._attr(), dict): self._attr.clear() else: @@ -735,7 +736,7 @@ class ContainerSubHandler(SubHandler): index = int(index) # TODO validation try: return self._vattr()[index] - except IndexError: + except LookupError: raise ItemNotFoundError(index) @handler(u'Get information about all items') -- 2.43.0