Add logging call

This commit is contained in:
Ludovic Stephan 2019-06-17 21:20:57 +02:00
parent 20bb9fe54b
commit edd92beadf

View file

@ -1,10 +1,12 @@
import logging
from functools import wraps from functools import wraps
from django.contrib.auth.decorators import login_required, user_passes_test from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import PermissionRequiredMixin from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.exceptions import PermissionDenied
from django.shortcuts import render from django.shortcuts import render
logger = logging.getLogger(__name__)
def cof_required(view_func): def cof_required(view_func):
"""Décorateur qui vérifie que l'utilisateur est connecté et membre du COF. """Décorateur qui vérifie que l'utilisateur est connecté et membre du COF.
@ -69,4 +71,7 @@ class BuroRequiredMixin(PermissionRequiredMixin):
try: try:
return self.request.user.profile.is_buro return self.request.user.profile.is_buro
except AttributeError: except AttributeError:
logger.error(
"L'utilisateur %s n'a pas de profil !", self.request.user.username
)
return False return False