mirror of https://github.com/django/django.git
Removed unneeded calls to iri_to_uri() in cache key generation.
request.build_absolute_uri() already applies iri_to_uri()
This commit is contained in:
parent
75d2af2c89
commit
143d8e1ab3
|
@ -23,7 +23,6 @@ from collections import defaultdict
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import caches
|
from django.core.cache import caches
|
||||||
from django.http import HttpResponse, HttpResponseNotModified
|
from django.http import HttpResponse, HttpResponseNotModified
|
||||||
from django.utils.encoding import iri_to_uri
|
|
||||||
from django.utils.http import (
|
from django.utils.http import (
|
||||||
http_date, parse_etags, parse_http_date_safe, quote_etag,
|
http_date, parse_etags, parse_http_date_safe, quote_etag,
|
||||||
)
|
)
|
||||||
|
@ -328,7 +327,7 @@ def _generate_cache_key(request, method, headerlist, key_prefix):
|
||||||
value = request.META.get(header)
|
value = request.META.get(header)
|
||||||
if value is not None:
|
if value is not None:
|
||||||
ctx.update(value.encode())
|
ctx.update(value.encode())
|
||||||
url = hashlib.md5(iri_to_uri(request.build_absolute_uri()).encode('ascii'))
|
url = hashlib.md5(request.build_absolute_uri().encode('ascii'))
|
||||||
cache_key = 'views.decorators.cache.cache_page.%s.%s.%s.%s' % (
|
cache_key = 'views.decorators.cache.cache_page.%s.%s.%s.%s' % (
|
||||||
key_prefix, method, url.hexdigest(), ctx.hexdigest())
|
key_prefix, method, url.hexdigest(), ctx.hexdigest())
|
||||||
return _i18n_cache_key_suffix(request, cache_key)
|
return _i18n_cache_key_suffix(request, cache_key)
|
||||||
|
@ -336,7 +335,7 @@ def _generate_cache_key(request, method, headerlist, key_prefix):
|
||||||
|
|
||||||
def _generate_cache_header_key(key_prefix, request):
|
def _generate_cache_header_key(key_prefix, request):
|
||||||
"""Return a cache key for the header cache."""
|
"""Return a cache key for the header cache."""
|
||||||
url = hashlib.md5(iri_to_uri(request.build_absolute_uri()).encode('ascii'))
|
url = hashlib.md5(request.build_absolute_uri().encode('ascii'))
|
||||||
cache_key = 'views.decorators.cache.cache_header.%s.%s' % (
|
cache_key = 'views.decorators.cache.cache_header.%s.%s' % (
|
||||||
key_prefix, url.hexdigest())
|
key_prefix, url.hexdigest())
|
||||||
return _i18n_cache_key_suffix(request, cache_key)
|
return _i18n_cache_key_suffix(request, cache_key)
|
||||||
|
|
Loading…
Reference in New Issue