Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#8178 closed (fixed)

Insert linebreaks in debug summary

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

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 8 years ago.
8178.stylefix.diff (605 bytes) - added by Julien Phalip 8 years ago.
The error message should not have a sans-serif font.

Download all attachments as: .zip

Change History (15)

Changed 8 years ago by Julien Phalip

Attachment: 8178.linebreaks.diff added

comment:1 Changed 8 years ago by Julian Bez

milestone: 1.0 beta
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedReady for checkin

comment:2 Changed 8 years ago by Julien Phalip

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 Changed 8 years ago by Julian Bez

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

comment:4 Changed 8 years ago by Marinho Brandão

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

comment:5 in reply to:  4 Changed 8 years ago by Julien Phalip

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 Changed 8 years ago by Russell Keith-Magee

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 Changed 8 years ago by Julian Bez

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 Changed 8 years ago by Malcolm Tredinnick

Resolution: fixed
Status: closedreopened

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

comment:9 Changed 8 years ago by Russell Keith-Magee

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 Changed 8 years ago by Julien Phalip

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.

Changed 8 years ago by Julien Phalip

Attachment: 8178.stylefix.diff added

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

comment:11 Changed 8 years ago by Russell Keith-Magee

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 Changed 8 years ago by Julien Phalip

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 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

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