Code

That's gadfly done, mostly. Things left:
[roundup.git] / roundup / cgitb.py
index 71a8c8003d98b1397916958bd511dec8798300bf..d7837ca055ca14beb80b49ef1581989876a5494a 100644 (file)
@@ -1,24 +1,16 @@
 #
-# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
-# This module is free software, and you may redistribute it and/or modify
-# under the same terms as Python, so long as this copyright message and
-# disclaimer are retained in their original form.
-#
-# IN NO EVENT SHALL THE BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
-# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
-# OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
-# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
-# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
-# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+# This module was written by Ka-Ping Yee, <ping@lfw.org>.
 # 
-# $Id: cgitb.py,v 1.4 2001-08-07 00:15:51 richard Exp $
+# $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> ' +
@@ -33,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 = []
@@ -58,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
 
@@ -83,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:
@@ -132,6 +124,26 @@ def handler():
 
 #
 # $Log: not supported by cvs2svn $
+# 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 :)
 #