]> git.llucax.com Git - software/pymin.git/commitdiff
Bugfix: catch LookupErrors instead of IndexError in ContainerSubHandler.
authorLeandro Lucarella <llucax@gmail.com>
Tue, 16 Oct 2007 03:25:17 +0000 (00:25 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Tue, 16 Oct 2007 03:25:17 +0000 (00:25 -0300)
pymin/services/util.py

index 2fe7f9b6d45e3d9dcabdeb8f09c0670c5a92392a..9c96fcab36d6b56f645ccd6ffe5d565f1f72c67e 100644 (file)
@@ -703,7 +703,7 @@ class ContainerSubHandler(SubHandler):
             item.update(*args, **kwargs)
             if hasattr(item, '_update'):
                 item._update = True
             item.update(*args, **kwargs)
             if hasattr(item, '_update'):
                 item._update = True
-        except IndexError:
+        except LookupError:
             raise ItemNotFoundError(index)
 
     @handler(u'Delete an item')
             raise ItemNotFoundError(index)
 
     @handler(u'Delete an item')
@@ -718,11 +718,12 @@ class ContainerSubHandler(SubHandler):
             else:
                 del self._attr()[index]
             return item
             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):
             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:
         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]
             index = int(index) # TODO validation
         try:
             return self._vattr()[index]
-        except IndexError:
+        except LookupError:
             raise ItemNotFoundError(index)
 
     @handler(u'Get information about all items')
             raise ItemNotFoundError(index)
 
     @handler(u'Get information about all items')