add last parameter to plugin registration

Signed-off-by: martin f. krafft <madduck@madduck.net>
master
martin f. krafft 2008-03-21 19:12:13 +01:00 committed by Joey Hess
parent e3624de63c
commit 5184b8abfc
1 changed files with 5 additions and 4 deletions

View File

@ -160,10 +160,10 @@ class IkiWikiProcedureProxy(object):
self._xmlrpc_handler = _IkiWikiExtPluginXMLRPCHandler(self._debug_fn) self._xmlrpc_handler = _IkiWikiExtPluginXMLRPCHandler(self._debug_fn)
self._xmlrpc_handler.register_function(self._importme, name='import') self._xmlrpc_handler.register_function(self._importme, name='import')
def hook(self, type, function, name=None): def hook(self, type, function, name=None, last=False):
if name is None: if name is None:
name = function.__name__ name = function.__name__
self._hooks.append((type, name)) self._hooks.append((type, name, last))
def hook_proxy(*args): def hook_proxy(*args):
# curpage = args[0] # curpage = args[0]
@ -182,10 +182,11 @@ class IkiWikiProcedureProxy(object):
def _importme(self): def _importme(self):
self._debug_fn('importing...') self._debug_fn('importing...')
for type, function in self._hooks: for type, function, last in self._hooks:
self._debug_fn('hooking %s into %s chain...' % (function, type)) self._debug_fn('hooking %s into %s chain...' % (function, type))
self._xmlrpc_handler.send_rpc('hook', self._in_fd, self._out_fd, self._xmlrpc_handler.send_rpc('hook', self._in_fd, self._out_fd,
id=self._id, type=type, call=function) id=self._id, type=type, call=function,
last=last)
return IkiWikiProcedureProxy._IKIWIKI_NIL_SENTINEL return IkiWikiProcedureProxy._IKIWIKI_NIL_SENTINEL
def run(self): def run(self):