item.update(*args, **kwargs)
if hasattr(item, '_update'):
item._update = True
- except IndexError:
+ except LookupError:
raise ItemNotFoundError(index)
@handler(u'Delete an 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):
+ r"clear() -> None :: Delete all items of the container."
+ if isinstance(self._attr(), dict):
+ self._attr.clear()
+ else:
+ self._attr(list())
+
@handler(u'Get information about an item')
def get(self, index):
r"get(index) -> item :: List all the information of an item."
index = int(index) # TODO validation
try:
return self._vattr()[index]
- except IndexError:
+ except LookupError:
raise ItemNotFoundError(index)
@handler(u'Get information about all items')