Permalink
Browse files

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
  • Loading branch information...
1 parent 7e210f6 commit f5c1bb1cad5d06935ed07bbeace64be36643f512 @gdub gdub committed Jul 2, 2008
Showing with 10 additions and 6 deletions.
  1. +10 −6 django/test/client.py
View
@@ -291,12 +291,16 @@ def login(self, **credentials):
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()

0 comments on commit f5c1bb1

Please sign in to comment.