mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-07 16:41:06 +00:00
Return the function again from the hook decorator
The decorator variant of hook registration did not return anything, meaning that the decorated function would end up being `None`. This was not noticed, as the functions are rarely called manually, as opposed to being invoked via the hook.
This commit is contained in:
parent
59966b5385
commit
edd8ac2d77
1 changed files with 4 additions and 1 deletions
|
|
@ -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] = []
|
||||
|
|
|
|||
Loading…
Reference in a new issue