From 1ecdd9f6b53fec45e1d48592e3ff56aa7a576bec Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 8 Jan 2012 16:47:52 +0100 Subject: some cleanups, closed #490 --- module/plugins/Hook.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'module/plugins/Hook.py') diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index c0ce7d99c..83ef091ae 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/Hook.py @@ -19,22 +19,25 @@ from traceback import print_exc -from functools import wraps +#from functools import wraps from module.utils import has_method from Base import Base +def class_name(p): + return p.rpartition(".")[2] + class Expose(object): """ used for decoration to declare rpc services """ def __new__(cls, f, *args, **kwargs): - hookManager.addRPC(f.__module__, f.func_name, f.func_doc) + hookManager.addRPC(class_name(f.__module__), f.func_name, f.func_doc) return f def AddEventListener(event): """ used to register method for events """ class _klass(object): def __new__(cls, f, *args, **kwargs): - hookManager.addEventListener(f.__module__, f.func_name, event) + hookManager.addEventListener(class_name(f.__module__), f.func_name, event) return f return _klass @@ -42,11 +45,11 @@ def AddEventListener(event): class ConfigHandler(object): """ register method as config handler """ def __new__(cls, f, *args, **kwargs): - hookManager.addConfigHandler(f.__module__, f.func_name) + hookManager.addConfigHandler(class_name(f.__module__), f.func_name) return f def threaded(f): - @wraps(f) + #@wraps(f) def run(*args,**kwargs): hookManager.startThread(f, *args, **kwargs) return run -- cgit v1.2.3