|
Amir Salihefendic
amix at amix.dk
Sat Aug 14 13:59:15 EDT 2004
I have made (at least for me) the error output more readable by
highlighting the important things.
In apche.py function ReportError I have added following code:
else:
# write to client
req.content_type = 'text/html'
#Search patterns
pattern_file = re.compile('\/([\w]+\.[\D]{1,5})",')
pattern_line = re.compile("line ([\d]+)")
pattern_in = re.compile(", in ([\w]+)")
pattern_type = re.compile("^([A-Za-z]+): (.+)$")
s = '\n<h3>Mod_python error: "%s
%s"</h3>\n<pre>\n\n' % (phase, hname)
for e in traceback.format_exception(etype, evalue,
etb):
e = pattern_line.sub(r'<b>line</b> <font
color="blue">\1</font>', e)
e = pattern_file.sub(r'/<font
color="green">\1</font>,', e)
e = pattern_in.sub(r', in <font
color="darkred">\1</font>', e)
e = pattern_type.sub(r'<font
color="darkblue">\1</font>: <i>\2</i>', e)
s += e + '\n'
s += "</pre>\n"
To make this work, you of course need to "import re" in the top of
apache.py.
The output should look something like this:
http://amix.dk/output_colorfull.png
Kind regards
Amir Salihefendic
-----
What we do in life echoes in eternity
|