Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit c19ef69c5c9435bd3c559f32e34d56ae76c645ac 1 parent c4679bb
Adrian Holovaty authored July 20, 2006

Showing 1 changed file with 8 additions and 2 deletions. Show diff stats Hide diff stats

  1. 10  django/contrib/auth/__init__.py
10  django/contrib/auth/__init__.py
@@ -56,8 +56,14 @@ def logout(request):
56 56
     """
57 57
     Remove the authenticated user's ID from the request.
58 58
     """
59  
-    del request.session[SESSION_KEY]
60  
-    del request.session[BACKEND_SESSION_KEY]
  59
+    try:
  60
+        del request.session[SESSION_KEY]
  61
+    except KeyError:
  62
+        pass
  63
+    try:
  64
+        del request.session[BACKEND_SESSION_KEY]
  65
+    except KeyError:
  66
+        pass
61 67
 
62 68
 def get_user(request):
63 69
     from django.contrib.auth.models import AnonymousUser

0 notes on commit c19ef69

Please sign in to comment.
Something went wrong with that request. Please try again.