From f5c1bb1cad5d06935ed07bbeace64be36643f512 Mon Sep 17 00:00:00 2001 From: Gary Wilson Jr Date: Wed, 2 Jul 2008 04:48:58 +0000 Subject: [PATCH] Got rid of a bit of repetition by using `dict.update()`. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7821 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/test/client.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/django/test/client.py b/django/test/client.py index bfe3e16f3a..87731043a7 100644 --- a/django/test/client.py +++ b/django/test/client.py @@ -291,12 +291,16 @@ class Client: login(request, user) # Set the cookie to represent the session. - self.cookies[settings.SESSION_COOKIE_NAME] = request.session.session_key - self.cookies[settings.SESSION_COOKIE_NAME]['max-age'] = None - self.cookies[settings.SESSION_COOKIE_NAME]['path'] = '/' - self.cookies[settings.SESSION_COOKIE_NAME]['domain'] = settings.SESSION_COOKIE_DOMAIN - self.cookies[settings.SESSION_COOKIE_NAME]['secure'] = settings.SESSION_COOKIE_SECURE or None - self.cookies[settings.SESSION_COOKIE_NAME]['expires'] = None + session_cookie = settings.SESSION_COOKIE_NAME + self.cookies[session_cookie] = request.session.session_key + cookie_data = { + 'max-age': None, + 'path': '/', + 'domain': settings.SESSION_COOKIE_DOMAIN, + 'secure': settings.SESSION_COOKIE_SECURE or None, + 'expires': None, + } + self.cookies[session_cookie].update(cookie_data) # Save the session values. request.session.save()