Fix Warning when using legacy hooks function

This commit is contained in:
Némunaire 2012-11-02 17:29:22 +01:00
parent 3a82cc00cd
commit d4cfe1e0f8

View File

@ -136,7 +136,7 @@ class ModuleLoader(SourceLoader):
if not hasattr(module, "nemubotversion"): if not hasattr(module, "nemubotversion"):
raise ImportError("Module `%s' is not a nemubot module."%self.name) raise ImportError("Module `%s' is not a nemubot module."%self.name)
# Check module version # Check module version
if module.nemubotversion > self.context.version: if module.nemubotversion != self.context.version:
raise ImportError("Module `%s' is not compatible with this " raise ImportError("Module `%s' is not compatible with this "
"version." % self.name) "version." % self.name)
@ -222,11 +222,11 @@ def register_hooks(module, context, prompt):
# Register legacy hooks # Register legacy hooks
if hasattr(module, "parseanswer"): if hasattr(module, "parseanswer"):
context.hooks.add_hook("cmd_default", Hook(module.parseanswer)) context.hooks.add_hook("cmd_default", Hook(module.parseanswer), module)
if hasattr(module, "parseask"): if hasattr(module, "parseask"):
context.hooks.add_hook("ask_default", Hook(module.parseask)) context.hooks.add_hook("ask_default", Hook(module.parseask), module)
if hasattr(module, "parselisten"): if hasattr(module, "parselisten"):
context.hooks.add_hook("msg_default", Hook(module.parselisten)) context.hooks.add_hook("msg_default", Hook(module.parselisten), module)
########################## ##########################
# # # #