Skip to content

Commit

Permalink
Fixup: Comment to explain why we bother to check for request.user
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmiller committed Dec 4, 2017
1 parent de6d121 commit 211f234
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions opal/core/log.py
Expand Up @@ -20,6 +20,8 @@ def emit(self, record):
if hasattr(record, "request") and record.request:
user = "anonymous"

# In case the error occurrs before the authentication middleware
# has run we need to check that the request has a user
if hasattr(record.request, "user"):
if record.request.user.is_authenticated():
user = record.request.user.username
Expand Down

0 comments on commit 211f234

Please sign in to comment.