Fixed #2368 -- Fixed KeyError when trying to log out more than once. Thanks, Gary Wilson

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3402 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-07-20 20:26:10 +00:00
parent c4679bb83f
commit c19ef69c5c
1 changed files with 8 additions and 2 deletions

View File

@ -56,8 +56,14 @@ def logout(request):
""" """
Remove the authenticated user's ID from the request. Remove the authenticated user's ID from the request.
""" """
try:
del request.session[SESSION_KEY] del request.session[SESSION_KEY]
except KeyError:
pass
try:
del request.session[BACKEND_SESSION_KEY] del request.session[BACKEND_SESSION_KEY]
except KeyError:
pass
def get_user(request): def get_user(request):
from django.contrib.auth.models import AnonymousUser from django.contrib.auth.models import AnonymousUser