Pass self to HookMixin hooks

This commit is contained in:
Chase Sterling 2016-07-08 02:10:26 -04:00
parent 3c3d39c771
commit c0a4e6b480

View file

@ -7,7 +7,7 @@ def hook_func(name, fn):
@wraps(fn)
def wrapper(self, *args, **kwargs):
for hook, a, kw in self.__class__._pre_hooks.get(name) or []:
hook(*args, **kwargs)
hook(self, *args, **kwargs)
rv = fn(self, *args, **kwargs)
@ -15,7 +15,7 @@ def hook_func(name, fn):
kwargs.update(dict(rv=rv))
for hook, a, kw in self.__class__._post_hooks.get(name) or []:
hook(*args, **kwargs)
hook(self, *args, **kwargs)
return rv
return wrapper