From 066b7ef8b45149aec09d41ca74b08d0b8711cb13 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 15 Oct 2007 21:02:34 -0300 Subject: [PATCH] Add a clear() method to ContainerSubHandler to remove all the items. --- pymin/services/util.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pymin/services/util.py b/pymin/services/util.py index b665c00..2fe7f9b 100644 --- a/pymin/services/util.py +++ b/pymin/services/util.py @@ -721,6 +721,13 @@ class ContainerSubHandler(SubHandler): except IndexError: raise ItemNotFoundError(index) + @handler(u'Remove all items (use with care).') + def clear(self): + 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." -- 2.43.0