Currently:
{{{
Traceback:
File "…/Vcs/django/django/template/base.py" in __init__
663. token.Meh
During handling of the above exception ('str' object has no attribute
'Meh'), another exception occurred:
File "…/Vcs/django/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "…/Vcs/django/django/core/handlers/base.py" in _get_response
145. response = self.process_exception_by_middleware(e,
request)
File "…/Vcs/django/django/core/handlers/base.py" in _get_response
143. response = response.render()
File "…/Vcs/django/django/template/response.py" in render
106. self.content = self.rendered_content
File "…/Vcs/django/django/template/response.py" in rendered_content
83. content = template.render(context, self._request)
File "…/Vcs/django/django/template/backends/django.py" in render
61. return self.template.render(context)
File "…/Vcs/django/django/template/base.py" in render
171. return self._render(context)
File "…/Vcs/django/django/test/utils.py" in instrumented_test_render
96. return self.nodelist.render(context)
File "…/Vcs/django/django/template/base.py" in render
940. bit = node.render_annotated(context)
File "…/Vcs/django/django/template/base.py" in render_annotated
907. return self.render(context)
File "…/Vcs/django/django/template/loader_tags.py" in render
150. return compiled_parent._render(context)
File "…/Vcs/django/django/test/utils.py" in instrumented_test_render
96. return self.nodelist.render(context)
File "…/Vcs/django/django/template/base.py" in render
940. bit = node.render_annotated(context)
File "…/Vcs/django/django/template/base.py" in render_annotated
907. return self.render(context)
File "…/Vcs/django/django/template/loader_tags.py" in render
127. compiled_parent = self.get_parent(context)
File "…/Vcs/django/django/template/loader_tags.py" in get_parent
124. return self.find_template(parent, context)
File "…/Vcs/django/django/template/loader_tags.py" in find_template
104. template_name, skip=history,
File "…/Vcs/django/django/template/engine.py" in find_template
125. template = loader.get_template(name, skip=skip)
File "…/Vcs/django/django/template/loaders/base.py" in get_template
30. contents, origin, origin.template_name,
self.engine,
File "…/Vcs/django/django/template/base.py" in __init__
156. self.nodelist = self.compile_nodelist()
File "…/Vcs/django/django/template/base.py" in compile_nodelist
194. return parser.parse()
File "…/Vcs/django/django/template/base.py" in parse
449. raise self.error(token, e)
File "…/Vcs/django/django/template/base.py" in parse
447. filter_expression =
self.compile_filter(token.contents)
File "…/Vcs/django/django/template/base.py" in compile_filter
563. return FilterExpression(token, self)
File "…/Vcs/django/django/template/base.py" in __init__
666. "from '%s'" %
(token[upto:], token))
Exception Type: TemplateSyntaxError at /a/login
Exception Value: Could not parse the remainder: '("foo")' from
'myecho("foo")'
}}}
Better:
{{{
Traceback (most recent call last):
File "…/Vcs/django/django/template/base.py", line 663, in __init__
token.Meh
During handling of the above exception ('str' object has no attribute
'Meh'), another exception occurred:
File "…/Vcs/django/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "…/Vcs/django/django/core/handlers/base.py", line 145, in
_get_response
response = self.process_exception_by_middleware(e, request)
File "…/Vcs/django/django/core/handlers/base.py", line 143, in
_get_response
response = response.render()
File "…/Vcs/django/django/template/response.py", line 106, in render
self.content = self.rendered_content
File "…/Vcs/django/django/template/response.py", line 83, in
rendered_content
content = template.render(context, self._request)
File "…/Vcs/django/django/template/backends/django.py", line 61, in
render
return self.template.render(context)
File "…/Vcs/django/django/template/base.py", line 171, in render
return self._render(context)
File "…/Vcs/django/django/test/utils.py", line 96, in
instrumented_test_render
return self.nodelist.render(context)
File "…/Vcs/django/django/template/base.py", line 940, in render
bit = node.render_annotated(context)
File "…/Vcs/django/django/template/base.py", line 907, in
render_annotated
return self.render(context)
File "…/Vcs/django/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "…/Vcs/django/django/test/utils.py", line 96, in
instrumented_test_render
return self.nodelist.render(context)
File "…/Vcs/django/django/template/base.py", line 940, in render
bit = node.render_annotated(context)
File "…/Vcs/django/django/template/base.py", line 907, in
render_annotated
return self.render(context)
File "…/Vcs/django/django/template/loader_tags.py", line 127, in render
compiled_parent = self.get_parent(context)
File "…/Vcs/django/django/template/loader_tags.py", line 124, in
get_parent
return self.find_template(parent, context)
File "…/Vcs/django/django/template/loader_tags.py", line 104, in
find_template
template_name, skip=history,
File "…/Vcs/django/django/template/engine.py", line 125, in
find_template
template = loader.get_template(name, skip=skip)
File "…/Vcs/django/django/template/loaders/base.py", line 30, in
get_template
contents, origin, origin.template_name, self.engine,
File "…/Vcs/django/django/template/base.py", line 156, in __init__
self.nodelist = self.compile_nodelist()
File "…/Vcs/django/django/template/base.py", line 194, in
compile_nodelist
return parser.parse()
File "…/Vcs/django/django/template/base.py", line 449, in parse
raise self.error(token, e)
File "…/Vcs/django/django/template/base.py", line 447, in parse
filter_expression = self.compile_filter(token.contents)
File "…/Vcs/django/django/template/base.py", line 563, in compile_filter
return FilterExpression(token, self)
File "…/Vcs/django/django/template/base.py", line 666, in __init__
"from '%s'" % (token[upto:], token))
Exception Type: TemplateSyntaxError at /a/login
Exception Value: Could not parse the remainder: '("foo")' from
'myecho("foo")'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30411>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Daniel Hahler):
There are two other issues here:
1. I would like to have it more at the bottom
2. the "Template error" part is not plain text:
{{{
Template error:
In template …/templates/base.html, error at line 10
Could not parse the remainder: '("foo")' from 'myecho("foo")'
1 : {# {% extends "base.html" %} #}
2 :
…
12 : </html>
13 :
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:1>
* component: Core (Other) => Error reporting
* easy: 0 => 1
* stage: Unreviewed => Accepted
Comment:
OK, fine, improvements here welcome. Marking Easy Pickings... since it
should just be formatting/template changes.
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:2>
* owner: nobody => Naved Khan
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:3>
Comment (by Daniel Hahler):
@Naved
Just to make sure it's not missed, there is an initial PR already at
https://github.com/django/django/pull/11287.
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:4>
* owner: Naved Khan => Daniel Hahler
* has_patch: 0 => 1
* version: 2.2 => master
Comment:
[https://github.com/django/django/pull/11287 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:5>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:6>
* status: assigned => new
* owner: Daniel Hahler => (none)
Comment:
Deassigning due to inactivity.
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:7>
Comment (by SunYiZheXinKe):
I'm new to Django and I am intending to accept this issue. However I have
a few questions to ask.
Firstly, how to make Django use technical_500.txt as a template? When I
raise exceptions in views Django use technical_500.html instead.
Secondly, why is the existing pull request not accepted, and how can I
improve it?
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:8>
* status: new => assigned
* owner: (none) => Jerrod Martin
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:9>
Comment (by Jerrod Martin):
New pull request with tests. [https://github.com/django/django/pull/11596]
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:10>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:11>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:12>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:13>
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:14>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"c7bef16a749ccbe2dbc8ce6b697dc80146584384" c7bef16]:
{{{
#!CommitTicketReference repository=""
revision="c7bef16a749ccbe2dbc8ce6b697dc80146584384"
Fixed #30411 -- Improved formatting of text tracebacks in technical 500
templates.
Co-Authored-By: Daniel Hahler <g...@thequod.de>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30411#comment:15>