You need something like:
def f1():
return True
f1 = validate_arguments(arg1, arg2)(f1)
Here validate_arguments(arg1, arg2)
returns the actual decorator, to that decorator we pass the function object f1
, which in turn returns the new modified function.
Demo:
def validate_arguments(arg1, arg2):
def decorator(func):
def wrapped():
print arg1, arg2
return func()
return wrapped
return decorator
def f1():
return True
f1 = validate_arguments(1, 2)(f1)
print f1()
#1 2
#True