diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py index 0ffa35bcff2..428efe62398 100644 --- a/django/contrib/auth/views.py +++ b/django/contrib/auth/views.py @@ -34,9 +34,8 @@ def login(request, template_name='registration/login.html'): def logout(request, next_page=None, template_name='registration/logged_out.html'): "Logs out the user and displays 'You are logged out' message." from django.contrib.auth import logout - try: - logout(request) - except KeyError: + logout(request) + if next_page is None: return render_to_response(template_name, {'title': _('Logged out')}, context_instance=RequestContext(request)) else: # Redirect to this page until the session has been cleared.