Last active
October 11, 2015 13:57
-
-
Save eos87/3869003 to your computer and use it in GitHub Desktop.
decorator in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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