1
0
mirror of https://github.com/django/django.git synced 2025-10-26 15:16:09 +00:00

Fixed #5816 -- Fixed a regression from [6333] that generates incorrect cookie "expires" dates when using a locale other than English. Introduced http_date and cookie_date utility functions. Thanks for the report Michael Lemaire. Thanks for the patch Karen Tracey and SmileyChris.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6634 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Gary Wilson Jr
2007-10-31 03:59:40 +00:00
parent 39f28512b9
commit 8c442f21dc
7 changed files with 51 additions and 21 deletions

View File

@@ -20,11 +20,11 @@ An example: i18n middleware would need to distinguish caches by the
import md5
import re
import time
from email.Utils import formatdate
from django.conf import settings
from django.core.cache import cache
from django.utils.encoding import smart_str, iri_to_uri
from django.utils.http import http_date
cc_delim_re = re.compile(r'\s*,\s*')
@@ -89,9 +89,9 @@ def patch_response_headers(response, cache_timeout=None):
if not response.has_header('ETag'):
response['ETag'] = md5.new(response.content).hexdigest()
if not response.has_header('Last-Modified'):
response['Last-Modified'] = formatdate()[:26] + "GMT"
response['Last-Modified'] = http_date()
if not response.has_header('Expires'):
response['Expires'] = formatdate(time.time() + cache_timeout)[:26] + "GMT"
response['Expires'] = http_date(time.time() + cache_timeout)
patch_cache_control(response, max_age=cache_timeout)
def add_never_cache_headers(response):