Permalink
Browse files

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
  • Loading branch information...
1 parent c4679bb commit c19ef69c5c9435bd3c559f32e34d56ae76c645ac @adrianholovaty adrianholovaty committed Jul 20, 2006
Showing with 8 additions and 2 deletions.
  1. +8 −2 django/contrib/auth/__init__.py
View
10 django/contrib/auth/__init__.py
@@ -56,8 +56,14 @@ def logout(request):
"""
Remove the authenticated user's ID from the request.
"""
- del request.session[SESSION_KEY]
- del request.session[BACKEND_SESSION_KEY]
+ try:
+ del request.session[SESSION_KEY]
+ except KeyError:
+ pass
+ try:
+ del request.session[BACKEND_SESSION_KEY]
+ except KeyError:
+ pass
def get_user(request):
from django.contrib.auth.models import AnonymousUser

0 comments on commit c19ef69

Please sign in to comment.