Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Middleware: add check if request has user attribute (e.g. WSGIRequest…

… doesn’t)
  • Loading branch information...
commit 95c449f56f6f016a2c6adfac3b13d4a81f034f6c 1 parent 440f6a7
@fiee fiee authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 async_messages/middleware.py
View
8 async_messages/middleware.py
@@ -6,9 +6,11 @@
class AsyncMiddleware(object):
def process_response(self, request, response):
- # Check for messages for this user and, if it exists,
- # call the messages API with it
- if hasattr(request, "session") and request.user.is_authenticated():
+ """
+ Check for messages for this user and, if it exists,
+ call the messages API with it
+ """
+ if hasattr(request, "session") and hasattr(request, "user") and request.user.is_authenticated():
msgs = get_messages(request.user)
if msgs:
for msg, level in msgs:
Please sign in to comment.
Something went wrong with that request. Please try again.