From cd5751b7a49f12ae9baf33f7c692dc9da85d355e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 5 Jul 2009 02:37:03 +0200 Subject: Add dummy_hook() --- portato/plugin.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'portato/plugin.py') diff --git a/portato/plugin.py b/portato/plugin.py index 4914f25..c823ac7 100644 --- a/portato/plugin.py +++ b/portato/plugin.py @@ -635,6 +635,18 @@ def hook(hook, *args, **kwargs): else: return __plugins.hook(hook, *args, **kwargs) +def dummy_hook (h, *args, **kwargs): + """ + Creates a dummy hook, i.e. a hook which is only needed to trigger something in the plugins, but does nothing for itself. + """ + + if __plugins is None: + pass + else: + def dummy (): + pass + hook(h, *args, **kwargs)(dummy)() + def register (plugin, disable = False): """ Registers a plugin. -- cgit v1.2.3