mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
[py3] Fixed encoding issues in cache key generation
This commit is contained in:
parent
d774ad752d
commit
45baaabafb
3 changed files with 7 additions and 6 deletions
4
tests/regressiontests/cache/tests.py
vendored
4
tests/regressiontests/cache/tests.py
vendored
|
@ -1308,7 +1308,7 @@ class CacheI18nTest(TestCase):
|
|||
# This is tightly coupled to the implementation,
|
||||
# but it's the most straightforward way to test the key.
|
||||
tz = force_text(timezone.get_current_timezone_name(), errors='ignore')
|
||||
tz = tz.encode('ascii', 'ignore').replace(' ', '_')
|
||||
tz = tz.encode('ascii', 'ignore').decode('ascii').replace(' ', '_')
|
||||
response = HttpResponse()
|
||||
key = learn_cache_key(request, response)
|
||||
self.assertIn(tz, key, "Cache keys should include the time zone name when time zones are active")
|
||||
|
@ -1320,7 +1320,7 @@ class CacheI18nTest(TestCase):
|
|||
request = self._get_request()
|
||||
lang = translation.get_language()
|
||||
tz = force_text(timezone.get_current_timezone_name(), errors='ignore')
|
||||
tz = tz.encode('ascii', 'ignore').replace(' ', '_')
|
||||
tz = tz.encode('ascii', 'ignore').decode('ascii').replace(' ', '_')
|
||||
response = HttpResponse()
|
||||
key = learn_cache_key(request, response)
|
||||
self.assertNotIn(lang, key, "Cache keys shouldn't include the language name when i18n isn't active")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue