Skip to content

Commit

Permalink
Removed persistence of preferred language in session during logout. (#…
Browse files Browse the repository at this point in the history
…1617)

Since Django 2.1 language is stored in settings.LANGUAGE_COOKIE_NAME.
Legacy support for handling it in the session is removed in Django 4.0.
  • Loading branch information
carltongibson committed Jan 24, 2021
1 parent c371152 commit ece488b
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions channels/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from django.contrib.auth.models import AnonymousUser
from django.utils.crypto import constant_time_compare
from django.utils.functional import LazyObject
from django.utils.translation import LANGUAGE_SESSION_KEY

from channels.db import database_sync_to_async
from channels.middleware import BaseMiddleware
Expand Down Expand Up @@ -126,11 +125,7 @@ def logout(scope):
user = None
if user is not None:
user_logged_out.send(sender=user.__class__, request=None, user=user)
# remember language choice saved to session
language = session.get(LANGUAGE_SESSION_KEY)
session.flush()
if language is not None:
session[LANGUAGE_SESSION_KEY] = language
if "user" in scope:
scope["user"] = AnonymousUser()

Expand Down

0 comments on commit ece488b

Please sign in to comment.