Make call_hook return a useful value.
[rawdog/.git] / rawdoglib / plugins.py
index 0e3d276c56d59244ecb71d2cea49de3cd5695806..eb81c942293887468cae595fadb5e22d07b14a21 100644 (file)
@@ -56,8 +56,10 @@ def attach_hook(hookname, func):
 def call_hook(hookname, *args):
        """Call all the functions attached to a hook with the given
        arguments, in the order they were added, stopping if a hook function
-       returns False."""
+       returns False. Returns True if any hook function returned False (i.e.
+       returns True if any hook function handled the request)."""
        for func in attached.get(hookname, []):
                if not func(*args):
-                       break
+                       return True
+       return False