get actual exception class instead of 'unicode' in the error view
authorSylvain Thenault <sylvain.thenault@logilab.fr>
Fri, 05 Dec 2008 18:05:09 +0100
changeset 174 a2966960d550
parent 169 0e031b66cb0b
child 175 5c7bb5f1ede0
get actual exception class instead of 'unicode' in the error view
web/views/management.py
--- a/web/views/management.py	Fri Dec 05 17:26:39 2008 +0100
+++ b/web/views/management.py	Fri Dec 05 18:05:09 2008 +0100
@@ -199,11 +199,17 @@
         self.w(u'<h2>%s</h2>' % title)
         if 'errmsg' in req.data:
             ex = req.data['errmsg']
+            exclass = None
         else:
+            exclass = ex.__class__.__name__
             ex = exc_message(ex, req.encoding)
         if excinfo is not None and self.config['print-traceback']:
-            exclass = ex.__class__.__name__
-            self.w(u'<div class="tb">%s: %s</div>' % (exclass, html_escape(ex).replace("\n","<br />")))
+            if exclass is None:
+                self.w(u'<div class="tb">%s</div>'
+                       % html_escape(ex).replace("\n","<br />"))
+            else:
+                self.w(u'<div class="tb">%s: %s</div>'
+                       % (exclass, html_escape(ex).replace("\n","<br />")))
             self.w(u'<hr />')
             self.w(u'<div class="tb">%s</div>' % html_traceback(excinfo, ex, ''))
         else: