diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-04-01 18:20:53 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-04-01 18:20:53 +0000 |
| commit | e047110657dd3dcf87841cec0c48b01dd5cb4695 (patch) | |
| tree | aa48ae4f222fcf31f34646cba38426fb62eaab3e /django | |
| parent | 34e823a699ff21c3780f2bcc52ca0cc7b50931a6 (diff) | |
[1.0.X] Fixed #10016: the cache middleware no longer vomits when handed long URLs. Thanks, Matt Croydon. Backport of r10335 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10336 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/utils/cache.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/django/utils/cache.py b/django/utils/cache.py index 31111a44fd..3c40e17e90 100644 --- a/django/utils/cache.py +++ b/django/utils/cache.py @@ -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): """ |
