diff options
Diffstat (limited to 'django')
| -rw-r--r-- | django/test/client.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/test/client.py b/django/test/client.py index f4435c090f..b144fe2fdb 100644 --- a/django/test/client.py +++ b/django/test/client.py @@ -334,10 +334,12 @@ class Client(object): def logout(self): """ - Removes the authenticated user's cookies. + Removes the authenticated user's cookies and session object. Causes the authenticated user to be logged out. """ session = __import__(settings.SESSION_ENGINE, {}, {}, ['']).SessionStore() - session.delete(session_key=self.cookies[settings.SESSION_COOKIE_NAME].value) + session_cookie = self.cookies.get(settings.SESSION_COOKIE_NAME) + if session_cookie: + session.delete(session_key=session_cookie.value) self.cookies = SimpleCookie() |
