File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -889,10 +889,15 @@ def default_urlconf(request):
889
889
{% else %}
890
890
{{ source_line.0 }} : {{ source_line.1 }}
891
891
{% endifequal %}{% endfor %}{% endif %}
892
- Traceback:
893
- {% for frame in frames %}File "{{ frame.filename|escape }}" in {{ frame.function|escape }}
894
- {% if frame.context_line %} {{ frame.lineno }}. {{ frame.context_line|escape }}{% endif %}
895
- {% endfor %}
892
+ Traceback:{% for frame in frames %}
893
+ {% ifchanged frame.exc_cause %}{% if frame.exc_cause %}{% if frame.exc_cause_explicit %}
894
+ The above exception ({{ frame.exc_cause }}) was the direct cause of the following exception:
895
+ {% else %}
896
+ During handling of the above exception ({{ frame.exc_cause }}), another exception occurred:
897
+ {% endif %}{% endif %}{% endifchanged %}
898
+ File "{{ frame.filename|escape }}" in {{ frame.function|escape }}
899
+ {% if frame.context_line %} {{ frame.lineno }}. {{ frame.context_line|escape }}{% endif %}{% endfor %}
900
+
896
901
Exception Type: {{ exception_type|escape }}{% if request %} at {{ request.path_info|escape }}{% endif %}
897
902
Exception Value: {{ exception_value|force_escape }}
898
903
</textarea>
Original file line number Diff line number Diff line change @@ -32,10 +32,13 @@ def test_reporting_of_nested_exceptions(self):
32
32
33
33
explicit_exc = 'The above exception ({0}) was the direct cause of the following exception:'
34
34
implicit_exc = 'During handling of the above exception ({0}), another exception occurred:'
35
+
35
36
reporter = ExceptionReporter (request , exc_type , exc_value , tb )
36
37
html = reporter .get_traceback_html ()
37
- self .assertIn (explicit_exc .format ("Top level" ), html )
38
- self .assertIn (implicit_exc .format ("Second exception" ), html )
38
+ # Both messages are twice on page -- one rendered as html,
39
+ # one as plain text (for pastebin)
40
+ self .assertEqual (2 , html .count (explicit_exc .format ("Top level" )))
41
+ self .assertEqual (2 , html .count (implicit_exc .format ("Second exception" )))
39
42
40
43
text = reporter .get_traceback_text ()
41
44
self .assertIn (explicit_exc .format ("Top level" ), text )
You can’t perform that action at this time.
0 commit comments