Merge "operation_log: Fix logout generating AttributeError"

This commit is contained in:
Jenkins 2017-06-30 10:01:59 +00:00 committed by Gerrit Code Review
commit f0c03afa25
1 changed files with 4 additions and 2 deletions

View File

@ -111,8 +111,10 @@ class OperationLogMiddleware(object):
def _get_log_format(self, request):
"""Return operation log format."""
if not (hasattr(request, 'user') and
request.user.is_authenticated()):
user = getattr(request, 'user', None)
if not user:
return
if not request.user.is_authenticated():
return
method = request.method.upper()
if not (method in self.target_methods):