add filter support

This commit is contained in:
Damien Elmes 2009-06-06 21:56:44 +09:00
parent 40a7278aa5
commit 1ec8baa459

View file

@ -25,6 +25,13 @@ def runHook(hook, *args):
for func in hook:
func(*args)
def runFilter(hook, arg):
hook = _hooks.get(hook, None)
if hook:
for func in hook:
arg = func(arg)
return arg
def addHook(hook, func):
"Add a function to hook. Ignore if already on hook."
if not _hooks.get(hook, None):