Pass self to HookMixin hooks
This commit is contained in:
parent
3c3d39c771
commit
c0a4e6b480
|
@ -7,7 +7,7 @@ def hook_func(name, fn):
|
||||||
@wraps(fn)
|
@wraps(fn)
|
||||||
def wrapper(self, *args, **kwargs):
|
def wrapper(self, *args, **kwargs):
|
||||||
for hook, a, kw in self.__class__._pre_hooks.get(name) or []:
|
for hook, a, kw in self.__class__._pre_hooks.get(name) or []:
|
||||||
hook(*args, **kwargs)
|
hook(self, *args, **kwargs)
|
||||||
|
|
||||||
rv = fn(self, *args, **kwargs)
|
rv = fn(self, *args, **kwargs)
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ def hook_func(name, fn):
|
||||||
kwargs.update(dict(rv=rv))
|
kwargs.update(dict(rv=rv))
|
||||||
|
|
||||||
for hook, a, kw in self.__class__._post_hooks.get(name) or []:
|
for hook, a, kw in self.__class__._post_hooks.get(name) or []:
|
||||||
hook(*args, **kwargs)
|
hook(self, *args, **kwargs)
|
||||||
|
|
||||||
return rv
|
return rv
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
Loading…
Reference in a new issue