~ubuntu-branches/ubuntu/lucid/anki/lucid-updates

« back to all changes in this revision

Viewing changes to libanki/anki/hooks.py

  • Committer: Bazaar Package Importer
  • Author(s): Mackenzie Morgan
  • Date: 2010-05-31 15:55:50 UTC
  • mfrom: (7.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100531155550-wj3tag8bvp6fwhpo
Tags: 0.9.9.8.6-2~lucid1
Backport from maverick to fix FTBFS (LP: #550145)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
        for func in hook:
26
26
            func(*args)
27
27
 
 
28
def runFilter(hook, arg, *args):
 
29
    hook = _hooks.get(hook, None)
 
30
    if hook:
 
31
        for func in hook:
 
32
            arg = func(arg, *args)
 
33
    return arg
 
34
 
28
35
def addHook(hook, func):
29
36
    "Add a function to hook. Ignore if already on hook."
30
37
    if not _hooks.get(hook, None):