diff options
author | Julien Palard <julien@palard.fr> | 2021-10-09 07:36:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-09 07:36:50 (GMT) |
commit | c91b6f57f3f75b482e4a9d30ad2afe37892a8ceb (patch) | |
tree | 765504d9d7408ce8359e0d1ce1557ad54d266926 /Lib/cgitb.py | |
parent | a98b273ce42f33d04c8b85b8d574c47adf11dd2a (diff) | |
download | cpython-c91b6f57f3f75b482e4a9d30ad2afe37892a8ceb.zip cpython-c91b6f57f3f75b482e4a9d30ad2afe37892a8ceb.tar.gz cpython-c91b6f57f3f75b482e4a9d30ad2afe37892a8ceb.tar.bz2 |
bpo-10716: Migrating pydoc to html5. (GH-28651)
Diffstat (limited to 'Lib/cgitb.py')
-rw-r--r-- | Lib/cgitb.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Lib/cgitb.py b/Lib/cgitb.py index 17ddda3..ec15684 100644 --- a/Lib/cgitb.py +++ b/Lib/cgitb.py @@ -31,6 +31,7 @@ import tempfile import time import tokenize import traceback +from html import escape as html_escape def reset(): """Return a string that resets the CGI and browser to a known state.""" @@ -105,10 +106,16 @@ def html(einfo, context=5): etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) - head = '<body bgcolor="#f0f0f8">' + pydoc.html.heading( - '<big><big>%s</big></big>' % - strong(pydoc.html.escape(str(etype))), - '#ffffff', '#6622aa', pyver + '<br>' + date) + ''' + head = f''' +<body bgcolor="#f0f0f8"> +<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> +<tr bgcolor="#6622aa"> +<td valign=bottom> <br> +<font color="#ffffff" face="helvetica, arial"> <br> +<big><big><strong>{html_escape(str(etype))}</strong></big></big></font></td> +<td align=right valign=bottom> +<font color="#ffffff" face="helvetica, arial">{pyver}<br>{date}</font></td> +</tr></table> <p>A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.</p>''' |