From 57a618ec992e77e83aa4894fcc3431f83db119c8 Mon Sep 17 00:00:00 2001 From: "Jeroen van Meeuwen (Kolab Systems)" Date: Sat, 11 Feb 2012 14:42:47 +0100 Subject: Always return a return value, by default None, and only after all plugins have run --- pykolab/plugins/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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""" -- cgit v1.1