Mercurial > p > roundup > code
comparison roundup/cgi/cgitb.py @ 7965:6763813d9d34
issue2551350 - Python changes for 3.12 with roundup 2.3.0 cgitb.py
Fix change in pydoc.html.header() signature. It dropped foreground and
background color arguments in 3.11 and newer.
Also enable test code for the html function.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 14 May 2024 21:27:28 -0400 |
| parents | 6c5f8da9fca7 |
| children | 9c3ec0a5c7fc |
comparison
equal
deleted
inserted
replaced
| 7964:791b61ed11c9 | 7965:6763813d9d34 |
|---|---|
| 125 _ = get_translator(i18n) | 125 _ = get_translator(i18n) |
| 126 etype, evalue = sys.exc_info()[0], sys.exc_info()[1] | 126 etype, evalue = sys.exc_info()[0], sys.exc_info()[1] |
| 127 if type(etype) is type: | 127 if type(etype) is type: |
| 128 etype = etype.__name__ | 128 etype = etype.__name__ |
| 129 pyver = 'Python ' + sys.version.split()[0] + '<br>' + sys.executable | 129 pyver = 'Python ' + sys.version.split()[0] + '<br>' + sys.executable |
| 130 head = pydoc.html.heading( | 130 |
| 131 _('<font size=+1><strong>%(exc_type)s</strong>: %(exc_value)s</font>') | 131 if sys.version_info[0:2] >= (3,11): |
| 132 % {'exc_type': etype, 'exc_value': evalue}, | 132 head = pydoc.html.heading( |
| 133 '#ffffff', '#777777', pyver) | 133 _('<font size=+1><strong>%(exc_type)s</strong>: ' |
| 134 '%(exc_value)s</font>') | |
| 135 % {'exc_type': etype, 'exc_value': evalue}, pyver) | |
| 136 else: | |
| 137 head = pydoc.html.heading( | |
| 138 _('<font size=+1><strong>%(exc_type)s</strong>: ' | |
| 139 '%(exc_value)s</font>') | |
| 140 % {'exc_type': etype, 'exc_value': evalue}, | |
| 141 '#ffffff', '#777777', pyver) | |
| 134 | 142 |
| 135 head = head + (_('<p>A problem occurred while running a Python script. ' | 143 head = head + (_('<p>A problem occurred while running a Python script. ' |
| 136 'Here is the sequence of function calls leading up to ' | 144 'Here is the sequence of function calls leading up to ' |
| 137 'the error, with the most recent (innermost) call first. ' | 145 'the error, with the most recent (innermost) call first. ' |
| 138 'The exception attributes are:')) | 146 'The exception attributes are:')) |
