Skip to content

Instantly share code, notes, and snippets.

@batok
Created February 25, 2010 19:07
Show Gist options
  • Save batok/314920 to your computer and use it in GitHub Desktop.
Save batok/314920 to your computer and use it in GitHub Desktop.
prnt("*Extra parameters")
def security_level(function, args, kwargs, level):
prnt("You are level", level)
if level == "admin":
return True
elif "override_security" in kwargs:
del kwargs['override_security']
return True
else:
return False
@dectools.call_if(security_level, "admin")
def add_three(first, second, third):
prnt("adding", first, "+", second, "+", third)
return first + second + third
result = add_three(1, 2, 3)
prnt("1+2+3 =", result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment