This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Improving the html rendered by cgitb.html
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: iritkatriel, sblondon, vstinner
Priority: normal Keywords: patch

Created on 2018-05-14 20:55 by sblondon, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
next.png sblondon, 2018-05-14 20:55
current.png sblondon, 2018-05-14 20:59
Pull Requests
URL Status Linked Edit
PR 6854 closed sblondon, 2018-05-15 07:43
Messages (6)
msg316575 - (view) Author: Stéphane Blondon (sblondon) * Date: 2018-05-14 20:55
cgitb.html() returns HTML code viewable in a browser.

It would be nice to improve the rendering to have something more readable (increase space between each call, increase contrast for the source code) and more modern.

You can see the difference in the attached screenshot.
msg316577 - (view) Author: Stéphane Blondon (sblondon) * Date: 2018-05-14 20:59
current.png is a screenshot of the html shown in a browser with 3.8 branch
next.png is a screenshot of the modified cgitb.html() function.
msg316891 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-05-17 07:13
It's difficult to discuss colors, maybe because I'm partially colorblind :-), each people has different taste.

Instead of hardcoding colors, would it be better to use CSS instead.
msg317031 - (view) Author: Stéphane Blondon (sblondon) * Date: 2018-05-18 14:44
> Instead of hardcoding colors, would it be better to use CSS instead.

I agree with you. The current source code contains hardcoded colors. I
could add an optional parameter to change the css for the cgitb.html()
function:

def html(einfo, context=5, css=_DEFAULT_CSS):
   ...

_DEFAULT_CSS would be a string with the equivalent of the hardcoded style.

For this change, I will modify the html code to replace some
deprecated tags (like big or font) by supported tags.

What do you think about it (new optional parameter and html update)?
msg320079 - (view) Author: Stéphane Blondon (sblondon) * Date: 2018-06-20 14:31
I added the optional parameter to cgitb.html() function and removed the
hardcoded css from the html code.

I think there are still several improvements to do:
- add documentation for the new parameter of cgitb.html()
- add the same parameter to cgitb.enable() (?)
- remove the cgitb.grey() function because it's not used anymore (?)
- perhaps minor improvements of html and css code

What do you think about it?
msg415058 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-13 17:35
cgi/cgitb are deprecated as per PEP 594, so there won't be further enhancements to them.
History
Date User Action Args
2022-04-11 14:59:00adminsetgithub: 77688
2022-03-13 17:35:29iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg415058

resolution: wont fix
stage: patch review -> resolved
2018-06-20 14:31:32sblondonsetmessages: + msg320079
2018-05-18 14:44:49sblondonsetmessages: + msg317031
2018-05-17 07:13:16vstinnersetnosy: + vstinner
messages: + msg316891
2018-05-15 07:43:36sblondonsetkeywords: + patch
stage: patch review
pull_requests: + pull_request6529
2018-05-14 20:59:02sblondonsetfiles: + current.png

messages: + msg316577
2018-05-14 20:55:45sblondoncreate