@connected : getattr -> hasattr

This commit is contained in:
Maxime Alves LIRMM 2020-07-07 10:34:17 +02:00
parent 8b110d0fcd
commit 1aa03d9077
1 changed files with 2 additions and 4 deletions

View File

@ -8,11 +8,9 @@ def connected(func):
"""
@wraps(func)
def caller(req, *args, **kwargs):
try:
getattr(req.user, 'is_authenticated')
return func(req, **kwargs)
except AttributeError:
if not hasattr(req.user, 'is_authenticated'):
return False
return func(req, **kwargs)
return caller