Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#8178 closed (fixed)

Insert linebreaks in debug summary

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

Download all attachments as: .zip

Change History (15)

Changed 7 years ago by julien

comment:1 Changed 7 years ago by julianb

  • milestone set to 1.0 beta
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 7 years ago by julien

  • milestone changed from 1.0 beta to 1.0

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

comment:3 Changed 7 years ago by julianb

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

comment:4 follow-up: Changed 7 years ago by 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 :)

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 7 years ago by julien

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 7 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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 7 years ago by julianb

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 7 years ago by mtredinnick

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

comment:9 Changed 7 years ago by russellm

  • Resolution set to fixed
  • Status changed from reopened to closed

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

comment:10 Changed 7 years ago by julien

  • Resolution fixed deleted
  • Status changed from closed to reopened

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 7 years ago by julien

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

comment:11 Changed 7 years ago by russellm

  • Resolution set to fixed
  • Status changed from reopened to closed

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 7 years ago by julien

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 4 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

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