python3: use smart bytes for cache key

This commit is contained in:
Frédéric Péters 2018-04-10 21:48:12 +02:00
parent 86a3222ce8
commit 42cf2a71d9
1 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@ from django.forms import models as model_forms
from django import forms
from django import template
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible, force_text
from django.utils.encoding import python_2_unicode_compatible, force_text, smart_bytes
from django.utils.html import strip_tags
from django.utils.safestring import mark_safe
from django.utils.six.moves.urllib.parse import urlparse
@ -869,7 +869,7 @@ class FeedCell(CellBase):
if context.get('placeholder_search_mode'):
# don't call webservices when we're just looking for placeholders
return extra_context
cache_key = hashlib.md5(self.url).hexdigest()
cache_key = hashlib.md5(smart_bytes(self.url)).hexdigest()
feed_content = cache.get(cache_key)
if not feed_content:
feed_response = requests.get(utils.get_templated_url(self.url))
@ -888,7 +888,7 @@ class FeedCell(CellBase):
return extra_context
def render(self, context):
cache_key = hashlib.md5(self.url).hexdigest()
cache_key = hashlib.md5(smart_bytes(self.url)).hexdigest()
feed_content = cache.get(cache_key)
if not context.get('synchronous') and feed_content is None:
raise NothingInCacheException()