From a06fa6e7d35b408264ee0c2e19d2040ef54c5b4d Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sun, 24 Apr 2016 15:28:12 -0400 Subject: [1.9.x] Fixed #26536 -- Preserved leading dashes of the cached template loader keys. Thanks Anders Roos for the report. Backport of bd145e7209a0e628cced10384bd6f62d65c0f211 from master --- tests/template_tests/test_loaders.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/template_tests/test_loaders.py b/tests/template_tests/test_loaders.py index 35921e0472..feafeb2b06 100644 --- a/tests/template_tests/test_loaders.py +++ b/tests/template_tests/test_loaders.py @@ -146,6 +146,13 @@ class CachedLoaderTests(SimpleTestCase): # The two templates should not have the same content self.assertNotEqual(t1.render(Context({})), t2.render(Context({}))) + def test_template_name_leading_dash_caching(self): + """ + #26536 -- A leading dash in a template name shouldn't be stripped + from its cache key. + """ + self.assertEqual(self.engine.template_loaders[0].cache_key('-template.html', []), '-template.html') + @unittest.skipUnless(pkg_resources, 'setuptools is not installed') class EggLoaderTests(SimpleTestCase): -- cgit v1.3