self._hooks[name] = (d, ignore_count)
return d
- def _call_hook(self, res, name):
+ def _call_hook(self, res, name, async=False):
"""
Called to trigger the hook, with argument 'res'. This is a no-op if
the hook is unset. If the hook's ignore_count is positive, it will be
"""
hook = self._hooks[name]
if hook is None:
- return defer.succeed(None)
+ return None
(d, ignore_count) = hook
self._log("call_hook %r, ignore_count=%r" % (name, ignore_count))
self._hooks[name] = (d, ignore_count - 1)
else:
self._hooks[name] = None
- _with_log(d.callback, res)
+ if async:
+ _with_log(eventually_callback(d), res)
+ else:
+ _with_log(d.callback, res)
return res
def _log(self, msg):