#29399: Template rendering errors are incorrectly blamed on base template -------------------------------------------+------------------------ Reporter: oTree-org | Owner: nobody Type: Bug | Status: new Component: Template system | Version: 2.0 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------------+------------------------ Repro steps:
- create a "base.html" - create a "child.html" that inherits from base.html with `{% extends %}` put one of the following lines child.html: `{% url 'nonexistent' %}` `{% include 'nonexistent.html' %}` Expected: the yellow error page's "template debug" context should highlight the offending line, as it does when you have a TemplateSyntaxError during compilation. Actual: the error page incorrectly blames base.html, and says the error is at line 0: "Error during template rendering In template ...\base.html, error at line 0" It then shows the first 10 lines of base.html, but of course there is no error there. I think this is caused by `django.template.base.Node.render_annotated`, specifically this line: `e.template_debug = context.render_context.template.get_exception_info(e, self.token)` It seems fixed if I change it to: `e.template_debug = context.template.get_exception_info(e, self.token)` (I got the idea because I saw `context.template` referenced on the previous line.) You can run the attached project which reproduces the issue (run server and open to /). -- Ticket URL: <https://code.djangoproject.com/ticket/29399> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/052.5f14b1192b940d8fe2fd29a41b7f918a%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.