From: Anthony Towns Date: Fri, 21 Mar 2008 13:25:06 +0000 (+0000) Subject: extensions.py: update @replace_dak_function decorator to automatically X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=dbc5abe6dfdea06cb7eb120957233d48cc635d04;p=dak.git extensions.py: update @replace_dak_function decorator to automatically pass the old function as an argument to the new function --- diff --git a/config/debian/extensions.py b/config/debian/extensions.py index 7e418db3..d586d4d0 100644 --- a/config/debian/extensions.py +++ b/config/debian/extensions.py @@ -6,11 +6,19 @@ replaced_funcs = {} replace_funcs = {} def replace_dak_function(module,name): def x(f): - replace_funcs["%s:%s" % (module,name)] = f + def myfunc(*a,**kw): + global replaced_funcs + f(replaced_funcs[name], *a, **kw) + myfunc.__name__ = f.__name__ + myfunc.__doc__ = f.__doc__ + myfunc.__dict__.update(f.__dict__) + + replace_funcs["%s:%s" % (module,name)] = myfunc + return f return x @replace_dak_function("process-unchecked", "check_signed_by_key") -def check_signed_by_key(): +def check_signed_by_key(oldfn): changes = dak_module.changes reject = dak_module.reject @@ -21,11 +29,11 @@ def check_signed_by_key(): reject("Upload blocked due to hijack attempt 2008/03/19") # NB: 1.15.0, 1.15.2 signed by this key targetted at unstable - # have been made available in the wild, and should not be + # have been made available in the wild, and should remain # blocked until Debian's dpkg has revved past those version # numbers - replaced_funcs["check_signed_by_key"]() + oldfn() def init(name): global replaced_funcs