New global function: add_hook: add a hook in the current context directly associated to the current module

This commit is contained in:
Némunaire 2012-10-15 02:20:01 +02:00
commit bbfd34fe7b
6 changed files with 28 additions and 27 deletions

View file

@ -151,6 +151,7 @@ class ModuleLoader(SourceLoader):
module.print = lambda msg: print("[%s] %s"%(module.name, msg))
module.print_debug = lambda msg: mod_print_dbg(module, msg)
module.send_response = lambda srv, res: mod_send_response(self.context, srv, res)
module.add_hook = lambda store, hook: self.context.hooks.add_hook(store, hook, module)
if not hasattr(module, "NODATA"):
module.DATAS = xmlparser.parse_file(self.context.datas_path