Merge pull request #470 from takeflight/feature/admin-hook-decorator

Return the function again from the hook decorator
pull/472/head
Matt Westcott 2014-07-15 09:17:33 +01:00
commit d0c265f9b7
1 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -25,7 +25,10 @@ def register(hook_name, fn=None):
# Pretend to be a decorator if fn is not supplied
if fn is None:
return lambda fn: register(hook_name, fn)
def decorator(fn):
register(hook_name, fn)
return fn
return decorator
if hook_name not in _hooks:
_hooks[hook_name] = []