Mercurial > p > roundup > code
changeset 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 | 791b61ed11c9 |
| children | 1e38ca6fb16e |
| files | CHANGES.txt roundup/cgi/cgitb.py test/test_misc.py |
| diffstat | 3 files changed, 16 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Tue May 14 20:50:25 2024 -0400 +++ b/CHANGES.txt Tue May 14 21:27:28 2024 -0400 @@ -142,6 +142,9 @@ option is off when the setting is missing from detectors/config.ini. Other templates do not implement this option. (John Rouillard) +- issue2551350 - Python changes for 3.12 with roundup 2.3.0. Fixes for + cgitb.py crash due to pydoc.html.header() signature change. (Patch + by Andrew (kragacles), applied John Rouillard) Features:
--- a/roundup/cgi/cgitb.py Tue May 14 20:50:25 2024 -0400 +++ b/roundup/cgi/cgitb.py Tue May 14 21:27:28 2024 -0400 @@ -127,10 +127,18 @@ if type(etype) is type: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + '<br>' + sys.executable - head = pydoc.html.heading( - _('<font size=+1><strong>%(exc_type)s</strong>: %(exc_value)s</font>') - % {'exc_type': etype, 'exc_value': evalue}, - '#ffffff', '#777777', pyver) + + if sys.version_info[0:2] >= (3,11): + head = pydoc.html.heading( + _('<font size=+1><strong>%(exc_type)s</strong>: ' + '%(exc_value)s</font>') + % {'exc_type': etype, 'exc_value': evalue}, pyver) + else: + head = pydoc.html.heading( + _('<font size=+1><strong>%(exc_type)s</strong>: ' + '%(exc_value)s</font>') + % {'exc_type': etype, 'exc_value': evalue}, + '#ffffff', '#777777', pyver) head = head + (_('<p>A problem occurred while running a Python script. ' 'Here is the sequence of function calls leading up to '
--- a/test/test_misc.py Tue May 14 20:50:25 2024 -0400 +++ b/test/test_misc.py Tue May 14 21:27:28 2024 -0400 @@ -223,7 +223,7 @@ else: self.assertEqual(expected2, p) - def notest_html(self): + def test_html(self): """ templating error """ # enabiling this will cause the test to fail as the variable # is included in the live output but not in expected.
