summaryrefslogtreecommitdiff
path: root/portato/plugin.py
diff options
context:
space:
mode:
authornecoro <>2007-03-15 22:45:43 +0000
committernecoro <>2007-03-15 22:45:43 +0000
commit5138b1e23d34e0a72e0c2f4ae52256e14d825320 (patch)
treee300a29dd1acbd155e9afd9ca0de0036e85bb4a1 /portato/plugin.py
parent47a7b294e5a889afb932d371021d2b53adc20665 (diff)
downloadportato-5138b1e23d34e0a72e0c2f4ae52256e14d825320.tar.gz
portato-5138b1e23d34e0a72e0c2f4ae52256e14d825320.tar.bz2
portato-5138b1e23d34e0a72e0c2f4ae52256e14d825320.zip
Added etc-proposals plugin
Diffstat (limited to '')
-rw-r--r--portato/plugin.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/portato/plugin.py b/portato/plugin.py
index 4d49fc9..4ce4099 100644
--- a/portato/plugin.py
+++ b/portato/plugin.py
@@ -243,7 +243,7 @@ class PluginQueue:
else:
list = ([],[],[])
- def wrapper (self, *args, **kwargs):
+ def wrapper (*args, **kwargs):
# before
for cmd in list[0]:
@@ -254,7 +254,7 @@ class PluginQueue:
debug("Overriding hook '%s' with plugin '%s'" % (hook, list[1][0].hook.plugin.name))
call(list[1][0])
else: # normal
- func(self, *args, **kwargs)
+ func(*args, **kwargs)
# after
for cmd in list[2]:
@@ -368,3 +368,22 @@ class PluginQueue:
for hook in after:
resolve(hook, after[hook], 2, 1)
+
+
+__plugins = None
+
+def load_plugins():
+ global __plugins
+ if __plugins is None:
+ __plugins = PluginQueue()
+
+def get_plugins():
+ return __plugins
+
+def hook(hook, *args, **kwargs):
+ if __plugins is None:
+ def pseudo_decorator(f):
+ return f
+ return pseudo_decorator
+ else:
+ return __plugins.hook(hook, *args, **kwargs)