diff options
| author | Preston Timmons <preston.timmons@rewardstyle.com> | 2016-01-14 20:36:05 -0600 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-01-26 06:23:27 -0500 |
| commit | cfda1fa3f8d95f0f4a369da9021dbd770e5fa44a (patch) | |
| tree | dc84e9c48445c9e1ea17d91217686bcbec1ec76f /tests/template_tests/tests.py | |
| parent | 477274acb46b2f07666e9f84dea2e65ea6b63ad3 (diff) | |
Fixed #25848 -- Set template origin on each node.
Prior to 55f12f8709, the template origin was available on each node via
`self.token.source[0]`. This behavior was removed when debug handling was
simplified, but 3rd-party debugging tools still depend on its presence.
This updates the Parser to set origin on individual nodes. This enables the
source template to be determined even when template extending or including is
used.
Diffstat (limited to 'tests/template_tests/tests.py')
| -rw-r--r-- | tests/template_tests/tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py index 43cc182008..ff0b29073f 100644 --- a/tests/template_tests/tests.py +++ b/tests/template_tests/tests.py @@ -140,3 +140,12 @@ class TemplateTests(SimpleTestCase): child = engine.from_string( '{% extends parent %}{% block content %}child{% endblock %}') self.assertEqual(child.render(Context({'parent': parent})), 'child') + + def test_node_origin(self): + """ + #25848 -- Set origin on Node so debugging tools can determine which + template the node came from even if extending or including templates. + """ + template = Engine().from_string('content') + for node in template.nodelist: + self.assertEqual(node.origin, template.origin) |
