+ r"show() -> list of items :: List all the complete items information."
+ if isinstance(self._attr(), dict):
+ return self._attr().values()
+ return self._vattr()
+
+class ListSubHandler(ContainerSubHandler):
+ r"""ListSubHandler(parent) -> ListSubHandler instance.
+
+ This is a helper class to inherit from to automatically handle subcommands
+ that operates over a list parent attribute.
+
+ The list attribute to handle and the class of objects that it contains can
+ be defined by calling the constructor or in a more declarative way as
+ class attributes, like:
+
+ class TestHandler(ListSubHandler):
+ _cont_subhandler_attr = 'some_list'
+ _cont_subhandler_class = SomeClass
+
+ This way, the parent's some_list attribute (self.parent.some_list) will be
+ managed automatically, providing the commands: add, update, delete, get,
+ list and show. New items will be instances of SomeClass, which should
+ provide a cmp operator to see if the item is on the list and an update()
+ method, if it should be possible to modify it. If SomeClass has an _add,
+ _update or _delete attribute, it set them to true when the item is added,
+ updated or deleted respectively (in case that it's deleted, it's not
+ removed from the list, but it's not listed either).
+ """
+
+ @handler(u'Get how many items are in the list')
+ def len(self):
+ r"len() -> int :: Get how many items are in the list."
+ return len(self._vattr())
+
+class DictSubHandler(ContainerSubHandler):
+ r"""DictSubHandler(parent) -> DictSubHandler instance.