Skip to content

Commit 2c4d53d

Browse files
author
Richard Jones
committed
more helpful error messages (should make this switchable though)
1 parent 32d4c8e commit 2c4d53d

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

roundup/htmltemplate.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: htmltemplate.py,v 1.111 2002-08-15 00:40:10 richard Exp $
18+
# $Id: htmltemplate.py,v 1.112 2002-08-19 00:21:37 richard Exp $
1919

2020
__doc__ = """
2121
Template engine.
@@ -46,7 +46,11 @@
4646
a template function, add a test for all data types or the angry pink bunny
4747
will hunt you down.
4848
"""
49-
import weakref, os, types, cgi, sys, urllib, re
49+
import weakref, os, types, cgi, sys, urllib, re, traceback
50+
try:
51+
import cStringIO as StringIO
52+
except ImportError:
53+
import StringIO
5054
try:
5155
import cPickle as pickle
5256
except ImportError:
@@ -751,12 +755,11 @@ def render(self, nodeid):
751755
try:
752756
self._render()
753757
except:
754-
etype = sys.exc_type
755-
if type(etype) is types.ClassType:
756-
etype = etype.__name__
757-
w('<p class="system-msg">%s: %s</p>'%(etype, sys.exc_value))
758758
# make sure we don't commit any changes
759759
self.client.db.rollback()
760+
s = StringIO.StringIO()
761+
traceback.print_exc(None, s)
762+
w('<pre class="system-msg">%s</pre>'%cgi.escape(s.getvalue()))
760763
w('</form>')
761764
finally:
762765
self.cl = self.properties = self.client = None
@@ -797,6 +800,9 @@ def splitargs(*args, **kws):
797800

798801
#
799802
# $Log: not supported by cvs2svn $
803+
# Revision 1.111 2002/08/15 00:40:10 richard
804+
# cleanup
805+
#
800806
# Revision 1.110 2002/08/13 20:16:09 gmcm
801807
# Use a real parser for templates.
802808
# Rewrite htmltemplate to use the parser (hack, hack).

0 commit comments

Comments
 (0)