diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2012-02-11 14:42:47 +0100 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2012-02-11 14:42:47 +0100 |
commit | 57a618ec992e77e83aa4894fcc3431f83db119c8 (patch) | |
tree | 4daa30fa425a98e349d1d3085fa8a7af10bd3632 /pykolab/plugins | |
parent | b81fd0b37408891a312483242d90ac82e112ce04 (diff) | |
download | pykolab-57a618ec992e77e83aa4894fcc3431f83db119c8.tar.gz |
Always return a return value, by default None, and only after all plugins have run
Diffstat (limited to 'pykolab/plugins')
-rw-r--r-- | pykolab/plugins/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pykolab/plugins/__init__.py b/pykolab/plugins/__init__.py index 6bfd627..2dff5b8 100644 --- a/pykolab/plugins/__init__.py +++ b/pykolab/plugins/__init__.py @@ -211,6 +211,8 @@ class KolabPlugins(object): def exec_hook(self, hook, plugins=[], kw={}, args=()): """Execute a hook""" + retval = None + if len(plugins) < 1: plugins = self.plugins.keys() @@ -225,13 +227,14 @@ class KolabPlugins(object): if hasattr(getattr(self,plugin),hook): try: log.debug(_("Executing hook %s for plugin %s") %(hook,plugin), level=8) + print "retval = self.%s.%s(%r, %r)" %(plugin,hook, args, kw) exec("retval = self.%s.%s(*args, **kw)" %(plugin,hook)) except TypeError, e: log.error(_("Cannot execute hook %s for plugin %s: %s") %(hook,plugin,e)) except AttributeError, e: log.error(_("Cannot execute hook %s for plugin %s: %s") %(hook,plugin,e)) - return retval + return retval def return_true_boolean_from_plugins(self, bool, plugins=[]): """Given the name of a boolean, walks all specified plugins, or all available plugins, and returns True if a plugin has it set to true""" |