Opened 16 years ago

Closed 16 years ago

Last modified 12 years ago

#8178 closed (fixed)

Insert linebreaks in debug summary

Reported by: Julien Phalip Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When exceptions are raised, in particular in templates (e.g. with URL tag not matching a view), you get a big chunk of traceback info in the debug summary which is hard to read. Inserting linebreaks helps a lot. Patch attached.

Before:

Caught an exception while rendering: Original Traceback (most recent call last): File "E:\Software\workspace\django\django\template\debug.py", line 71, in render_node result = node.render(context) File "E:\Software\workspace\django-treemenus\trunk\treemenus\templatetags\tree_menu_tags.py", line 46, in render return urlNode.render(context) File "E:\Software\workspace\django\django\template\defaulttags.py", line 369, in render args=args, kwargs=kwargs) File "E:\Software\workspace\django\django\core\urlresolvers.py", line 307, in reverse *args, **kwargs))) File "E:\Software\workspace\django\django\core\urlresolvers.py", line 291, in reverse raise NoReverseMatch NoReverseMatch 

After:

Caught an exception while rendering:

Original Traceback (most recent call last):
File "E:\Software\workspace\django\django\template\debug.py", line 71, in render_node
result = node.render(context)
File "E:\Software\workspace\django-treemenus\trunk\treemenus\templatetags\tree_menu_tags.py", line 46, in render
return urlNode.render(context)
File "E:\Software\workspace\django\django\template\defaulttags.py", line 369, in render
args=args, kwargs=kwargs)
File "E:\Software\workspace\django\django\core\urlresolvers.py", line 307, in reverse
*args, **kwargs)))
File "E:\Software\workspace\django\django\core\urlresolvers.py", line 291, in reverse
raise NoReverseMatch
NoReverseMatch

Attachments (2)

8178.linebreaks.diff (483 bytes ) - added by Julien Phalip 16 years ago.
8178.stylefix.diff (605 bytes ) - added by Julien Phalip 16 years ago.
The error message should not have a sans-serif font.

Download all attachments as: .zip

Change History (15)

by Julien Phalip, 16 years ago

Attachment: 8178.linebreaks.diff added

comment:1 by Julian Bez, 16 years ago

milestone: 1.0 beta
Triage Stage: UnreviewedReady for checkin

comment:2 by Julien Phalip, 16 years ago

milestone: 1.0 beta1.0

This is only a small improvement and that doesn't quite fit in the 1.0 beta milestone.

comment:3 by Julian Bez, 16 years ago

Yes, sorry, but it's so tiny it should be in 1.0 nonetheless.

comment:4 by Marinho Brandão, 16 years ago

Why not show the exception message as PRE instead of H2 in template?

In my opinion would be better, because the formatting (including spaces) would be respected and be better as look :)

I created a ticket similar to this (I didn't know about this), take a look on that: #8265

in reply to:  4 comment:5 by Julien Phalip, 16 years ago

Replying to marinho:

Why not show the exception message as PRE instead of H2 in template?
In my opinion would be better, because the formatting (including spaces) would be respected and be better as look :)

Marinho, you're making a good point. The patch you've submitted in #8265 is indeed much better, and it should be used instead of the one I've submitted here.

comment:6 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: newclosed

(In [8407]) Fixed #8178: Cleaned up the rendering of exceptions on the error template. Thanks to Marinho Brandão for the fix.

comment:7 by Julian Bez, 16 years ago

You forgot to do the same where it says "Exception value". Here the fix:

Index: django/views/debug.py
===================================================================
--- django/views/debug.py	(revision 8409)
+++ django/views/debug.py	(working copy)
@@ -405,7 +405,7 @@
     </tr>
     <tr>
       <th>Exception Value:</th>
-      <td>{{ exception_value|escape }}</td>
+      <td><pre>{{ exception_value|escape }}</pre></td>
     </tr>
     <tr>
       <th>Exception Location:</th>

comment:8 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: closedreopened

Not reopening the ticket won't help the oversight get fixed.

comment:9 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: reopenedclosed

(In [8420]) Fixed #8178: Another update to debug template to aid rendering of exception traces. Thanks to julianb for the report.

comment:10 by Julien Phalip, 16 years ago

Resolution: fixed
Status: closedreopened

Sorry to re-re-open this, but Marinho's patch hadn't been applied correctly. The error message should not have a sans-serif font.
Patch attached.

by Julien Phalip, 16 years ago

Attachment: 8178.stylefix.diff added

The error message should not have a sans-serif font.

comment:11 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: reopenedclosed

Is your complaint about the serifs, or using a non-monospaced font? Using Helvetica/Arial family (non-monospaced, sans serif) was a conscious decision, because a big block of large, seriffed, monospaced text looks awful, and I couldn't see any loss in usability for the text that is returned.

comment:12 by Julien Phalip, 16 years ago

Thanks Russell for the info, and sorry for the noise. I wasn't sure if it was a mistake or a deliberate choice. Your reasons for keeping Helvetica/Arial totally make sense and I'm fine with it ;)

comment:13 by Jacob, 12 years ago

milestone: 1.0

Milestone 1.0 deleted

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