Skip to content

Instantly share code, notes, and snippets.

@eos87
Last active October 11, 2015 13:57
Show Gist options
  • Save eos87/3869003 to your computer and use it in GitHub Desktop.
Save eos87/3869003 to your computer and use it in GitHub Desktop.
decorator in python
def supercow_powers_required(func):
def wrapped_foo(request, **kwargs):
if request.user.is_someshit:
return func(request, **kwargs)
else:
return 'Denegado'
return wrapped_foo
@supercow_powers_required
def lpm(request):
print 'foo meh bla'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment