X-Git-Url: https://git.llucax.com/software/pymin.git/blobdiff_plain/b386d5537adb61f101a6fc82ca01e13de5b7b15f..b625efee35009ec66e13c5f54dd3b70b77f803d1:/pymin/services/util.py?ds=sidebyside diff --git a/pymin/services/util.py b/pymin/services/util.py index c0371a1..3f50957 100644 --- a/pymin/services/util.py +++ b/pymin/services/util.py @@ -9,7 +9,8 @@ try: except ImportError: import pickle -from pymin.dispatcher import Handler, handler, HandlerError +from pymin.dispatcher import Handler, handler, HandlerError, \ + CommandNotFoundError #DEBUG = False DEBUG = True @@ -619,6 +620,10 @@ class DictSubHandler(SubHandler): @handler(u'Update an item') def update(self, key, *args, **kwargs): r"update(key, ...) -> None :: Update an item of the dict." + # TODO make it right with metaclasses, so the method is not created + # unless the update() method really exists. + if not hasattr(self._dict_subhandler_class, 'update'): + raise CommandNotFoundError(('update',)) if not key in self._dict(): raise ItemNotFoundError(key) self._dict()[key].update(*args, **kwargs)