Ticket #13548: set_cookie.diff
File set_cookie.diff, 1.1 KB (added by , 14 years ago) |
---|
-
django/http/__init__.py
1 1 import os 2 2 import re 3 import time 3 4 from Cookie import BaseCookie, SimpleCookie, CookieError 4 5 from pprint import pformat 5 6 from urllib import urlencode … … 12 13 13 14 from django.utils.datastructures import MultiValueDict, ImmutableList 14 15 from django.utils.encoding import smart_str, iri_to_uri, force_unicode 16 from django.utils.http import cookie_date 15 17 from django.http.multipartparser import MultiPartParser 16 18 from django.conf import settings 17 19 from django.core.files import uploadhandler … … 373 375 374 376 def set_cookie(self, key, value='', max_age=None, expires=None, path='/', 375 377 domain=None, secure=False): 378 # IE doesn't support the max-age property 379 if max_age is not None and expires is None: 380 expires = cookie_date(time.time() + max_age) 376 381 self.cookies[key] = value 377 382 if max_age is not None: 378 383 self.cookies[key]['max-age'] = max_age