|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
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 $ |
19 | 19 |
|
20 | 20 | __doc__ = """ |
21 | 21 | Template engine. |
|
46 | 46 | a template function, add a test for all data types or the angry pink bunny |
47 | 47 | will hunt you down. |
48 | 48 | """ |
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 |
50 | 54 | try: |
51 | 55 | import cPickle as pickle |
52 | 56 | except ImportError: |
@@ -751,12 +755,11 @@ def render(self, nodeid): |
751 | 755 | try: |
752 | 756 | self._render() |
753 | 757 | 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)) |
758 | 758 | # make sure we don't commit any changes |
759 | 759 | 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())) |
760 | 763 | w('</form>') |
761 | 764 | finally: |
762 | 765 | self.cl = self.properties = self.client = None |
@@ -797,6 +800,9 @@ def splitargs(*args, **kws): |
797 | 800 |
|
798 | 801 | # |
799 | 802 | # $Log: not supported by cvs2svn $ |
| 803 | +# Revision 1.111 2002/08/15 00:40:10 richard |
| 804 | +# cleanup |
| 805 | +# |
800 | 806 | # Revision 1.110 2002/08/13 20:16:09 gmcm |
801 | 807 | # Use a real parser for templates. |
802 | 808 | # Rewrite htmltemplate to use the parser (hack, hack). |
|
0 commit comments