Opened 19 years ago

Closed 19 years ago

Last modified 6 years ago

#1458 closed Cleanup/optimization (wontfix)

make the template error page useful for command line clients

Reported by: Ian@… Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Daniel Hahler Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: yes

Description

when using curl, or a command line client (say a automated update bot) the error message is hard to understand (or even see)
my solution was to do the following

Index: debug.py
===================================================================
--- debug.py    (revision 2461)
+++ debug.py    (working copy)
@@ -181,6 +181,17 @@
 TECHNICAL_500_TEMPLATE = """
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html lang="en">
+<!--
+Traceback (most recent call last):
+{% for frame in frames %}
+  File "{{ frame.filename }}" in {{ frame.function }}
+  {% if frame.context_line %}
+    {{ frame.lineno|add:"1" }}. {{ frame.context_line|escape }}
+  {% endif %}
+{% endfor %}
+{{ exception_type }} at {{ request.path }}
+{{ exception_value|escape }}
+-->
 <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   <meta name="robots" content="NONE,NOARCHIVE" />
@@ -531,7 +542,17 @@
     display a standard 500 page.
   </p>
 </div>
-
+<!--
+Traceback (most recent call last):
+{% for frame in frames %}
+  File "{{ frame.filename }}" in {{ frame.function }}
+  {% if frame.context_line %}
+    {{ frame.lineno|add:"1" }}. {{ frame.context_line|escape }}
+  {% endif %}
+{% endfor %}
+{{ exception_type }} at {{ request.path }}
+{{ exception_value|escape }}
+-->
 </body>
 </html>
 """

which puts the traceback at the start and end of the HTML page as a comment so that the developer can just see it quickly.

Change History (2)

comment:1 by Adrian Holovaty, 19 years ago

Resolution: wontfix
Status: newclosed

This is an interesting idea, but I don't think it's worth adding.

comment:2 by Daniel Hahler, 6 years ago

Cc: Daniel Hahler added
Easy pickings: set
Triage Stage: Ready for checkinUnreviewed
Type: defectCleanup/optimization
UI/UX: set

It would be rather trivial (by now), since there is a text template already, which is used for AJAX: https://github.com/django/django/blob/586bf15f6f061b4fa99866fbfd9b33ae08789676/django/views/debug.py#L90

This could additionally check the user agent then.

I think it is very useful when developing.

Note: See TracTickets for help on using tickets.
Back to Top