1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Refs #15053 -- Clarified debug message when skipping templates to avoid recursion.

This commit is contained in:
Daniel Hahler 2019-04-26 20:06:18 +02:00 committed by Mariusz Felisiak
parent a1215a3237
commit c70cd2a926
2 changed files with 7 additions and 2 deletions

View File

@ -17,7 +17,7 @@ class Loader:
for origin in self.get_template_sources(template_name):
if skip is not None and origin in skip:
tried.append((origin, 'Skipped'))
tried.append((origin, 'Skipped to avoid recursion'))
continue
try:

View File

@ -64,8 +64,13 @@ class ExtendsBehaviorTests(SimpleTestCase):
"""
engine = Engine(dirs=[os.path.join(RECURSIVE, 'fs')])
template = engine.get_template('self.html')
with self.assertRaises(TemplateDoesNotExist):
with self.assertRaises(TemplateDoesNotExist) as e:
template.render(Context({}))
tried = e.exception.tried
self.assertEqual(len(tried), 1)
origin, message = tried[0]
self.assertEqual(origin.template_name, 'self.html')
self.assertEqual(message, 'Skipped to avoid recursion')
def test_extend_cached(self):
engine = Engine(