diff 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
line wrap: on
line diff
--- 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 '

Roundup Issue Tracker: http://roundup-tracker.org/