Fix server error for in-flight migration

This commit is contained in:
AlanCoding 2019-05-03 10:20:31 -04:00
parent 4be05f1bf6
commit d2e67aea19
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B

View File

@ -127,6 +127,9 @@ class SessionTimeoutMiddleware(object):
def process_response(self, request, response):
should_skip = 'HTTP_X_WS_SESSION_QUIET' in request.META
# Something went wrong, such as upgrade-in-progress page
if not hasattr(request, 'session'):
return response
# Only update the session if it hasn't been flushed by being forced to log out.
if request.session and not request.session.is_empty() and not should_skip:
expiry = int(settings.SESSION_COOKIE_AGE)