e.g.: I have got following error:
{{{
File "/home/petr/soubory/programovani/Auto-
mat/DPNK/dpnk/env/lib/python3.5/site-packages/django/template/base.py",
line 509, in parse
self.invalid_block_tag(token, command, parse_until)
File "/home/petr/soubory/programovani/Auto-
mat/DPNK/dpnk/env/lib/python3.5/site-packages/django/template/base.py",
line 565, in invalid_block_tag
get_text_list(["'%s'" % p for p in parse_until], 'or'),
django.template.exceptions.TemplateSyntaxError: Invalid block tag on line
127: 'endblock', expected 'empty' or 'endthumbnail'. Did you forget to
register or load this tag?
}}}
It contains even line number, but I have no idea in which file.
I think, it is not that difficult to include template name in the bug
report. In my case I tried to debug the error call. In
`django.template.base`, the `invalidb_block_tag` is called from `parse()`
where the template name can be obtained from `self.origin.template_name`.
--
Ticket URL: <https://code.djangoproject.com/ticket/28050>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:1>
* status: new => assigned
* owner: nobody => kapil garg
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:2>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:3>
* needs_better_patch: 0 => 1
Comment:
I'm not particularly pleased with the current patch which causes the
template name to be displayed redundantly several times in the debug view.
Hopefully we could avoid that.
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:4>
* owner: kapil garg => Roger Masse
Comment:
My plan is to improve the patch as described in the pull request with the
suggestion by timgraham:
''There might be a possibility for the debug view to modify
TemplateDoesNotExist's message so the redundant template names aren't
added. In any case, a test is required.''
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:5>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:6>
* has_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:7>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:8>
* cc: Roger Masse (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:9>
Comment (by Tim Graham):
#28698 is a duplicate with an alternate approach.
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:10>
* has_patch: 1 => 0
Comment:
The original pull request was closed by the author, and there's another
branch open that doesn't have a pull request yet (and I think still needs
some rebasing / squashing?)
If anyone thinks there's a clean patch available for this please post a
fresh link to it.
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:11>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
Comment:
There's [https://github.com/django/django/pull/8974 PR 8974] but I'm still
not convinced it's ideal.
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:12>
Comment (by Himanshu Chauhan):
I think that in case of Template Syntax Error it is very unhelpful to show
the python traceback because that will be usually same for all the errors
of this kind and as mentioned in the ticket does not show the template
file path where the error has been encountered. So my solution is to catch
the template syntax error exception and instead of going for default
python exception handling mechanism, we actually display the template
path, template line number and the exception message which I believe will
be more useful than the default python traceback in debugging template
errors.
I would like to work on this and want to know your views about my
approach.
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:13>
* owner: Roger Masse => Tim McCurrach
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:14>
* needs_tests: 0 => 1
Comment:
[https://github.com/django/django/pull/16937 New PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/28050#comment:15>