Loading django/template/loaders/cached.py +1 −1 Original line number Diff line number Diff line Loading @@ -131,7 +131,7 @@ class Loader(BaseLoader): template_tuple = self.template_cache.get(key) # A cached previous failure: if template_tuple is TemplateDoesNotExist: raise TemplateDoesNotExist raise TemplateDoesNotExist(template_name) elif template_tuple is None: template, origin = self.find_template(template_name, template_dirs) if not hasattr(template, 'render'): Loading docs/releases/1.9.3.txt +3 −0 Original line number Diff line number Diff line Loading @@ -46,3 +46,6 @@ Bugfixes * Changed the admin's "permission denied" message in the login template to use ``get_username`` instead of ``username`` to support custom user models (:ticket:`26231`). * Fixed a crash when passing a nonexistent template name to the cached template loader's ``load_template()`` method (:ticket:`26280`). tests/template_tests/test_loaders.py +12 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,18 @@ class CachedLoaderTests(SimpleTestCase): "Cached loader failed to cache the TemplateDoesNotExist exception", ) @ignore_warnings(category=RemovedInDjango20Warning) def test_load_nonexistent_cached_template(self): loader = self.engine.template_loaders[0] template_name = 'nonexistent.html' # fill the template cache with self.assertRaises(TemplateDoesNotExist): loader.find_template(template_name) with self.assertRaisesMessage(TemplateDoesNotExist, template_name): loader.get_template(template_name) def test_templatedir_caching(self): """ #13573 -- Template directories should be part of the cache key. Loading Loading
django/template/loaders/cached.py +1 −1 Original line number Diff line number Diff line Loading @@ -131,7 +131,7 @@ class Loader(BaseLoader): template_tuple = self.template_cache.get(key) # A cached previous failure: if template_tuple is TemplateDoesNotExist: raise TemplateDoesNotExist raise TemplateDoesNotExist(template_name) elif template_tuple is None: template, origin = self.find_template(template_name, template_dirs) if not hasattr(template, 'render'): Loading
docs/releases/1.9.3.txt +3 −0 Original line number Diff line number Diff line Loading @@ -46,3 +46,6 @@ Bugfixes * Changed the admin's "permission denied" message in the login template to use ``get_username`` instead of ``username`` to support custom user models (:ticket:`26231`). * Fixed a crash when passing a nonexistent template name to the cached template loader's ``load_template()`` method (:ticket:`26280`).
tests/template_tests/test_loaders.py +12 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,18 @@ class CachedLoaderTests(SimpleTestCase): "Cached loader failed to cache the TemplateDoesNotExist exception", ) @ignore_warnings(category=RemovedInDjango20Warning) def test_load_nonexistent_cached_template(self): loader = self.engine.template_loaders[0] template_name = 'nonexistent.html' # fill the template cache with self.assertRaises(TemplateDoesNotExist): loader.find_template(template_name) with self.assertRaisesMessage(TemplateDoesNotExist, template_name): loader.get_template(template_name) def test_templatedir_caching(self): """ #13573 -- Template directories should be part of the cache key. Loading