Mercurial > p > roundup > code
comparison roundup/cgi/cgitb.py @ 1079:04b44df7af1d
removed some property name clashes
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 09 Sep 2002 05:28:48 +0000 |
| parents | cf22c87d6fce |
| children | e5826025eeb7 |
comparison
equal
deleted
inserted
replaced
| 1078:344bad728d10 | 1079:04b44df7af1d |
|---|---|
| 1 # | 1 # |
| 2 # This module was written by Ka-Ping Yee, <ping@lfw.org>. | 2 # This module was written by Ka-Ping Yee, <ping@lfw.org>. |
| 3 # | 3 # |
| 4 # $Id: cgitb.py,v 1.3 2002-09-06 07:23:29 richard Exp $ | 4 # $Id: cgitb.py,v 1.4 2002-09-09 05:28:48 richard Exp $ |
| 5 | 5 |
| 6 __doc__ = """ | 6 __doc__ = """ |
| 7 Extended CGI traceback handler by Ka-Ping Yee, <ping@lfw.org>. | 7 Extended CGI traceback handler by Ka-Ping Yee, <ping@lfw.org>. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import sys, os, types, string, keyword, linecache, tokenize, inspect, pydoc | 10 import sys, os, types, string, keyword, linecache, tokenize, inspect |
| 11 import pydoc, traceback | |
| 11 | 12 |
| 12 from roundup.i18n import _ | 13 from roundup.i18n import _ |
| 13 | 14 |
| 14 def breaker(): | 15 def breaker(): |
| 15 return ('<body bgcolor="white">' + | 16 return ('<body bgcolor="white">' + |
| 49 supp, context, info = ts | 50 supp, context, info = ts |
| 50 l.append('in expression %r\n current variables:\n%s\n%s\n'%(info, | 51 l.append('in expression %r\n current variables:\n%s\n%s\n'%(info, |
| 51 niceDict(' ', context.global_vars), | 52 niceDict(' ', context.global_vars), |
| 52 niceDict(' ', context.local_vars))) | 53 niceDict(' ', context.local_vars))) |
| 53 # context._scope_stack)) | 54 # context._scope_stack)) |
| 55 | |
| 56 l.append('\n') | |
| 57 l.append(''.join(traceback.format_exception(etype, evalue, | |
| 58 sys.exc_traceback))) | |
| 54 return head + cgi.escape('\n'.join(l)) + '</pre><p> </p>' | 59 return head + cgi.escape('\n'.join(l)) + '</pre><p> </p>' |
| 55 | 60 |
| 56 def html(context=5): | 61 def html(context=5): |
| 57 etype, evalue = sys.exc_type, sys.exc_value | 62 etype, evalue = sys.exc_type, sys.exc_value |
| 58 if type(etype) is types.ClassType: | 63 if type(etype) is types.ClassType: |
| 161 print breaker() | 166 print breaker() |
| 162 print html() | 167 print html() |
| 163 | 168 |
| 164 # | 169 # |
| 165 # $Log: not supported by cvs2svn $ | 170 # $Log: not supported by cvs2svn $ |
| 171 # Revision 1.3 2002/09/06 07:23:29 richard | |
| 172 # tweak | |
| 173 # | |
| 166 # Revision 1.2 2002/09/06 07:21:31 richard | 174 # Revision 1.2 2002/09/06 07:21:31 richard |
| 167 # much nicer error messages when there's a templating error | 175 # much nicer error messages when there's a templating error |
| 168 # | 176 # |
| 169 # Revision 1.1 2002/08/30 08:28:44 richard | 177 # Revision 1.1 2002/08/30 08:28:44 richard |
| 170 # New CGI interface support | 178 # New CGI interface support |
