From 414ad25b090a63eaaf297b1164c8f7d814a710a2 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 7 Oct 2016 21:06:49 -0400 Subject: Fixed #27327 -- Simplified time zone handling by requiring pytz. --- tests/cache/tests.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'tests/cache') diff --git a/tests/cache/tests.py b/tests/cache/tests.py index 122017b54e..832727d53c 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -1832,17 +1832,16 @@ class CacheI18nTest(TestCase): @override_settings(USE_I18N=False, USE_L10N=False, USE_TZ=True) def test_cache_key_with_non_ascii_tzname(self): - # Regression test for #17476 - class CustomTzName(timezone.UTC): - name = '' - - def tzname(self, dt): - return self.name + # Timezone-dependent cache keys should use ASCII characters only + # (#17476). The implementation here is a bit odd (timezone.utc is an + # instance, not a class), but it simulates the correct conditions. + class CustomTzName(timezone.utc): + pass request = self.factory.get(self.path) response = HttpResponse() - with timezone.override(CustomTzName()): - CustomTzName.name = 'Hora estándar de Argentina'.encode('UTF-8') # UTF-8 string + with timezone.override(CustomTzName): + CustomTzName.zone = 'Hora estándar de Argentina'.encode('UTF-8') # UTF-8 string sanitized_name = 'Hora_estndar_de_Argentina' self.assertIn( sanitized_name, learn_cache_key(request, response), -- cgit v1.3