Created
September 29, 2015 14:03
-
-
Save fchevitarese/036d5e4a114efbdc6037 to your computer and use it in GitHub Desktop.
decorator_debug.py
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
from django.contrib.auth.models import User | |
def permissoes_decorator(f): | |
def verifica(request, *args, **kwargs): | |
pode_add = request.user.has_perm('rh.add_cadastro') | |
import pdb; pdb.set_trace() | |
if pode_add: | |
return f(request, *args, **kwargs) | |
else: | |
# CONDICAO DE SUCESSO, RETORNA AO FLUXO NORMAL | |
return False | |
verifica.__doc__= f.__doc__ | |
verifica.__name__= f.__name__ | |
return verifica |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment