mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
Fixed #10016: the cache middleware no longer vomits when handed long URLs. Thanks, Matt Croydon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10335 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -29,6 +29,7 @@ from django.core.cache import cache
|
||||
from django.utils.encoding import smart_str, iri_to_uri
|
||||
from django.utils.http import http_date
|
||||
from django.utils.hashcompat import md5_constructor
|
||||
from django.http import HttpRequest
|
||||
|
||||
cc_delim_re = re.compile(r'\s*,\s*')
|
||||
|
||||
@@ -143,13 +144,14 @@ def _generate_cache_key(request, headerlist, key_prefix):
|
||||
value = request.META.get(header, None)
|
||||
if value is not None:
|
||||
ctx.update(value)
|
||||
path = md5_constructor(iri_to_uri(request.path))
|
||||
return 'views.decorators.cache.cache_page.%s.%s.%s' % (
|
||||
key_prefix, iri_to_uri(request.path), ctx.hexdigest())
|
||||
key_prefix, path.hexdigest(), ctx.hexdigest())
|
||||
|
||||
def _generate_cache_header_key(key_prefix, request):
|
||||
"""Returns a cache key for the header cache."""
|
||||
return 'views.decorators.cache.cache_header.%s.%s' % (
|
||||
key_prefix, iri_to_uri(request.path))
|
||||
path = md5_constructor(iri_to_uri(request.path))
|
||||
return 'views.decorators.cache.cache_header.%s.%s' % (key_prefix, path.hexdigest())
|
||||
|
||||
def get_cache_key(request, key_prefix=None):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user