Code

implemented multilink changes (and a unit test)
[roundup.git] / roundup / cgitb.py
index 60ef5285e6250ec4e2f61e4388f8c75553ddc17a..d7837ca055ca14beb80b49ef1581989876a5494a 100644 (file)
@@ -1,7 +1,16 @@
-# $Id: cgitb.py,v 1.1 2001-07-22 11:58:35 richard Exp $
+#
+# This module was written by Ka-Ping Yee, <ping@lfw.org>.
+# 
+# $Id: cgitb.py,v 1.10 2002-01-16 04:49:45 richard Exp $
+
+__doc__ = """
+Extended CGI traceback handler by Ka-Ping Yee, <ping@lfw.org>.
+"""
 
 import sys, os, types, string, keyword, linecache, tokenize, inspect, pydoc
 
+from i18n import _
+
 def breaker():
     return ('<body bgcolor="#f0f0ff">' +
             '<font color="#f0f0ff" size="-5"> > </font> ' +
@@ -16,10 +25,10 @@ def html(context=5):
         '<font size=+1><strong>%s</strong>: %s</font>'%(str(etype), str(evalue)),
         '#ffffff', '#aa55cc', pyver)
 
-    head = head + ('<p>A problem occurred while running a Python script. '
+    head = head + (_('<p>A problem occurred while running a Python script. '
                    'Here is the sequence of function calls leading up to '
                    'the error, with the most recent (innermost) call first. '
-                   'The exception attributes are:')
+                   'The exception attributes are:'))
 
     indent = '<tt><small>%s</small>&nbsp;</tt>' % ('&nbsp;' * 5)
     traceback = []
@@ -41,7 +50,7 @@ def html(context=5):
 <table width="100%%" bgcolor="#d8bbff" cellspacing=0 cellpadding=2 border=0>
 <tr><td>%s %s</td></tr></table>''' % (link, call)
 
-        if file is None:
+        if index is None or file is None:
             traceback.append('<p>' + level)
             continue
 
@@ -66,13 +75,13 @@ def html(context=5):
                 if locals.has_key(name):
                     value = pydoc.html.repr(locals[name])
                 else:
-                    value = '<em>undefined</em>'
+                    value = _('<em>undefined</em>')
                 name = '<strong>%s</strong>' % name
             else:
                 if frame.f_globals.has_key(name):
                     value = pydoc.html.repr(frame.f_globals[name])
                 else:
-                    value = '<em>undefined</em>'
+                    value = _('<em>undefined</em>')
                 name = '<em>global</em> <strong>%s</strong>' % name
             lvals.append('%s&nbsp;= %s' % (name, value))
         if lvals:
@@ -115,14 +124,34 @@ def handler():
 
 #
 # $Log: not supported by cvs2svn $
-# Revision 1.3  2001/07/19 06:27:07  anthonybaxter
-# fixing (manually) the (dollarsign)Log(dollarsign) entries caused by
-# my using the magic (dollarsign)Id(dollarsign) and (dollarsign)Log(dollarsign)
-# strings in a commit message. I'm a twonk.
+# Revision 1.9  2002/01/08 11:56:24  richard
+# missed an import _
+#
+# Revision 1.8  2002/01/05 02:22:32  richard
+# i18n'ification
+#
+# Revision 1.7  2001/11/22 15:46:42  jhermann
+# Added module docstrings to all modules.
+#
+# Revision 1.6  2001/09/29 13:27:00  richard
+# CGI interfaces now spit up a top-level index of all the instances they can
+# serve.
+#
+# Revision 1.5  2001/08/07 00:24:42  richard
+# stupid typo
+#
+# Revision 1.4  2001/08/07 00:15:51  richard
+# Added the copyright/license notice to (nearly) all files at request of
+# Bizar Software.
+#
+# Revision 1.3  2001/07/29 07:01:39  richard
+# Added vim command to all source so that we don't get no steenkin' tabs :)
 #
-# Also broke the help string in two.
+# Revision 1.2  2001/07/22 12:09:32  richard
+# Final commit of Grande Splite
 #
-# Revision 1.2  2001/07/19 05:52:22  anthonybaxter
-# Added CVS keywords Id and Log to all python files.
+# Revision 1.1  2001/07/22 11:58:35  richard
+# More Grande Splite
 #
 #
+# vim: set filetype=python ts=4 sw=4 et si