diff options
author | martin f. krafft <madduck@madduck.net> | 2008-03-21 19:12:16 +0100 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-03-21 15:07:10 -0400 |
commit | 17dc5df1f5d1068ea0d18bc0bd1c75dc9ebeb65a (patch) | |
tree | 54740e27fde627b2e55faae20da1472addf3eabb /plugins | |
parent | 86ec72c8260a377617b215e7f021778f7507e3fb (diff) |
Allow individual hook registration to override ID
The preprocessor hooks need to specify IDs different from the ID used to
initialise the proxy. Thus, the hook function now takes an optional id
keyword argument and uses the ID used during initialisation if none is
provided.
Signed-off-by: martin f. krafft <madduck@madduck.net>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/proxy.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/proxy.py b/plugins/proxy.py index ea0ca9646..b4758b060 100644 --- a/plugins/proxy.py +++ b/plugins/proxy.py @@ -178,13 +178,16 @@ class IkiWikiProcedureProxy(object): ret = None return ret - def hook(self, type, function, name=None, last=False): + def hook(self, type, function, name=None, id=None, last=False): if self._imported: raise IkiWikiProcedureProxy.AlreadyImported if name is None: name = function.__name__ + if id is None: + id = self._id + def hook_proxy(*args): # curpage = args[0] # kwargs = dict([args[i:i+2] for i in xrange(1, len(args), 2)]) @@ -198,7 +201,7 @@ class IkiWikiProcedureProxy(object): ret = IkiWikiProcedureProxy._IKIWIKI_NIL_SENTINEL return ret - self._hooks.append((type, name, last)) + self._hooks.append((id, type, name, last)) self._xmlrpc_handler.register_function(hook_proxy, name=name) def inject(self, rname, function, name=None, memoize=True): @@ -258,9 +261,9 @@ class IkiWikiProcedureProxy(object): def _importme(self): self._debug_fn('importing...') - for type, function, last in self._hooks: - self._debug_fn('hooking %s into %s chain...' % (function, type)) - self.rpc('hook', id=self._id, type=type, call=function, last=last) + for id, type, function, last in self._hooks: + self._debug_fn('hooking %s/%s into %s chain...' % (id, function, type)) + self.rpc('hook', id=id, type=type, call=function, last=last) for rname, function, memoize in self._functions: self._debug_fn('injecting %s as %s...' % (function, rname)) self.rpc('inject', name=rname, call=function, memoize=memoize) |