comparison roundup/cgi/cgitb.py @ 1204:b862bbf2067a

Replaced the content() callback ickiness with Page Template macro usage changed the default CSS style to be less offensive to some ;) better handling of Page Template compilation errors removed dependency on ComputedAttribute
author Richard Jones <richard@users.sourceforge.net>
date Wed, 25 Sep 2002 02:10:25 +0000
parents 7e193bbda38e
children cce5b4309005
comparison
equal deleted inserted replaced
1203:735adcbfc665 1204:b862bbf2067a
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.6 2002-09-13 03:31:18 richard Exp $ 4 # $Id: cgitb.py,v 1.7 2002-09-25 02:10:25 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
27 def pt_html(context=5): 27 def pt_html(context=5):
28 l = ['<h1>Templating Error</h1>' 28 l = ['<h1>Templating Error</h1>'
29 '<p class="help">Debugging information follows</p>' 29 '<p class="help">Debugging information follows</p>'
30 '<ol>'] 30 '<ol>']
31 from roundup.cgi.PageTemplates.Expressions import TraversalError 31 from roundup.cgi.PageTemplates.Expressions import TraversalError
32 for frame, file, lnum, func, lines, index in inspect.trace(context): 32 t = inspect.trace(context)
33 t.reverse()
34 for frame, file, lnum, func, lines, index in t:
33 args, varargs, varkw, locals = inspect.getargvalues(frame) 35 args, varargs, varkw, locals = inspect.getargvalues(frame)
34 if locals.has_key('__traceback_info__'): 36 if locals.has_key('__traceback_info__'):
35 ti = locals['__traceback_info__'] 37 ti = locals['__traceback_info__']
36 if isinstance(ti, TraversalError): 38 if isinstance(ti, TraversalError):
37 s = [] 39 s = []
44 l.append('<li>In %s</li>'%cgi.escape(str(ti))) 46 l.append('<li>In %s</li>'%cgi.escape(str(ti)))
45 if locals.has_key('__traceback_supplement__'): 47 if locals.has_key('__traceback_supplement__'):
46 ts = locals['__traceback_supplement__'] 48 ts = locals['__traceback_supplement__']
47 if len(ts) == 2: 49 if len(ts) == 2:
48 supp, context = ts 50 supp, context = ts
49 l.append('<li>A problem occurred in your template "%s"</li>'% 51 s = 'A problem occurred in your template "%s".'%str(context.id)
50 str(context.id)) 52 if context._v_errors:
53 s = s + '<br>' + '<br>'.join(
54 [cgi.escape(x) for x in context._v_errors])
55 l.append('<li>%s</li>'%s)
51 elif len(ts) == 3: 56 elif len(ts) == 3:
52 supp, context, info = ts 57 supp, context, info = ts
53 l.append(''' 58 l.append('''
54 <li>While evaluating the %r expression on line %d 59 <li>While evaluating the %r expression on line %d
55 <table class="otherinfo" style="font-size: 90%%"> 60 <table class="otherinfo" style="font-size: 90%%">

Roundup Issue Tracker: http://roundup-tracker.org/