Skip to content

Commit

Permalink
bpo-10716: Migrating pydoc to html5. (GH-28651)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienPalard committed Oct 9, 2021
1 parent a98b273 commit c91b6f5
Show file tree
Hide file tree
Showing 7 changed files with 356 additions and 261 deletions.
15 changes: 11 additions & 4 deletions Lib/cgitb.py
Expand Up @@ -31,6 +31,7 @@
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."""
Expand Down Expand Up @@ -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>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<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>'''

Expand Down

0 comments on commit c91b6f5

Please sign in to comment.