@connected : getattr -> hasattr
This commit is contained in:
parent
8b110d0fcd
commit
1aa03d9077
|
@ -8,11 +8,9 @@ def connected(func):
|
||||||
"""
|
"""
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def caller(req, *args, **kwargs):
|
def caller(req, *args, **kwargs):
|
||||||
try:
|
if not hasattr(req.user, 'is_authenticated'):
|
||||||
getattr(req.user, 'is_authenticated')
|
|
||||||
return func(req, **kwargs)
|
|
||||||
except AttributeError:
|
|
||||||
return False
|
return False
|
||||||
|
return func(req, **kwargs)
|
||||||
|
|
||||||
return caller
|
return caller
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue