diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-01-08 16:47:52 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-01-08 16:47:52 +0100 |
commit | 1ecdd9f6b53fec45e1d48592e3ff56aa7a576bec (patch) | |
tree | 8d9e42cb670a24b4a9adb439cfc15c4277a61716 /module/plugins/Hook.py | |
parent | new MultiHoster hook (diff) | |
download | pyload-1ecdd9f6b53fec45e1d48592e3ff56aa7a576bec.tar.xz |
some cleanups, closed #490
Diffstat (limited to 'module/plugins/Hook.py')
-rw-r--r-- | module/plugins/Hook.py | 13 |
1 files changed, 8 insertions, 5 deletions
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 |