#27956: In DEBUG interface, the section "error during template rendering" 
doesn't
go inside an included template
---------------------------------+--------------------------------------
     Reporter:  Ling-Xiao Yang   |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  Template system  |                  Version:  master
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Unreviewed
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------
Changes (by Ling-Xiao Yang):

 * cc: ling-xiao.yang@… (added)
 * status:  closed => new
 * version:  1.10 => master
 * resolution:  duplicate =>


Comment:

 Replying to [comment:1 Tim Graham]:
 > This is issue #27584. I didn't backport it to 1.9 or 1.10 since the
 patch wasn't trivial and it went unreported for so long after the release
 of Django 1.9.

 Hello Tim,

 Thank you for pointing to #27584, but it seems that there's still a
 problem with `{% extend %}` tag, although it fixed the `{% include %}`
 tag. In its PR, there's only a unit test for `{% include %}` but not for
 `{% extend %}`.

 Here's the test for your reference:

 `27956_child.html`:

 {{{
 {% extends "27956_parent.html" %}

 {% block content %}{% endblock %}
 }}}

 `27956_parent.html`:


 {{{
 {% load tag_27584 %}

 {% badtag %}{% endbadtag %}

 {% block content %}{% endblock %}
 }}}

 The unit test:

 {{{
     def test_compile_tag_error_27956(self):
         engine = Engine(
             app_dirs=True,
             debug=True,
             libraries={'tag_27584':
 'template_tests.templatetags.tag_27584'},
         )
         t = engine.get_template('27956_child.html')
         with self.assertRaises(TemplateSyntaxError) as e:
             t.render(Context())
         self.assertEqual(e.exception.template_debug['during'], '{% badtag
 %}')
 }}}

 `{% badtag %}` is the one added in #27584's PR that raises a
 TemplateSyntaxError during its rendering.

 And this test doesn't pass on current master branch (7edeeb7):

 {{{
 ======================================================================
 FAIL: test_compile_tag_error_27956 (template_tests.tests.TemplateTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/usr/lib/python3.5/unittest/case.py", line 58, in testPartExecutor
     yield
   File "/usr/lib/python3.5/unittest/case.py", line 600, in run
     testMethod()
   File "/home/lxyang/django/tests/template_tests/tests.py", line 134, in
 test_compile_tag_error_27956
     self.assertEqual(e.exception.template_debug['during'], '{% badtag %}')
   File "/usr/lib/python3.5/unittest/case.py", line 820, in assertEqual
     assertion_func(first, second, msg=msg)
   File "/usr/lib/python3.5/unittest/case.py", line 813, in
 _baseAssertEqual
     raise self.failureException(msg)
 AssertionError: 'nt.html" %}\n' != '{% badtag %}'

 ----------------------------------------------------------------------
 }}}

 If I'm correct at my side, do we consider this still not fixed?

--
Ticket URL: <https://code.djangoproject.com/ticket/27956#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.4b9ab8a178bce09c9f0cc32d20facc45%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to