data sources: use bytes to generate hash for cache key (#36515)
This commit is contained in:
parent
ed9cdb777c
commit
9b2e2c8d13
|
@ -19,7 +19,7 @@ import hashlib
|
|||
import xml.etree.ElementTree as ET
|
||||
|
||||
from django.utils import six
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.encoding import force_text, force_bytes
|
||||
from django.utils.six.moves.urllib import parse as urllib
|
||||
from django.utils.six.moves.urllib import parse as urlparse
|
||||
|
||||
|
@ -189,7 +189,7 @@ def get_structured_items(data_source, mode=None):
|
|||
return request.datasources_cache[url]
|
||||
|
||||
if cache_duration:
|
||||
cache_key = 'data-source-%s' % hashlib.md5(url).hexdigest()
|
||||
cache_key = 'data-source-%s' % force_str(hashlib.md5(force_bytes(url)).hexdigest())
|
||||
from django.core.cache import cache
|
||||
items = cache.get(cache_key)
|
||||
if items is not None:
|
||||
|
|
Loading…
Reference in New Issue