1
0
mirror of https://github.com/django/django.git synced 2025-08-08 19:09:15 +00:00

Simplified SessionMiddleware.process_response() a bit.

This commit is contained in:
Daniel Hahler 2019-05-29 14:04:42 +02:00 committed by Mariusz Felisiak
parent 480492fe70
commit 59f04d6b8f

View File

@ -30,10 +30,9 @@ class SessionMiddleware(MiddlewareMixin):
modified = request.session.modified modified = request.session.modified
empty = request.session.is_empty() empty = request.session.is_empty()
except AttributeError: except AttributeError:
pass return response
else:
# First check if we need to delete this cookie. # First check if we need to delete this cookie.
# The session should be deleted only if the session is entirely empty # The session should be deleted only if the session is entirely empty.
if settings.SESSION_COOKIE_NAME in request.COOKIES and empty: if settings.SESSION_COOKIE_NAME in request.COOKIES and empty:
response.delete_cookie( response.delete_cookie(
settings.SESSION_COOKIE_NAME, settings.SESSION_COOKIE_NAME,