-
Notifications
You must be signed in to change notification settings - Fork 109
python 3.13 - deprecate cgi module #12296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Jenkins results:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good to me, Dario.
I would suggest to remove the other instance of quote()
, as I also cannot see it being used. However, I'd rather wait for Valentin's feedback on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dario, the proposed changes seems fine to me, and I'll suggest to remove tools.py:quote()
similar as you did in utils.py
as it is no longer in use.
1513247
to
2ed27d0
Compare
Dear Valentin and Alan, thanks for the review, I implemented your suggestions and removed |
Jenkins results:
|
Thank you, Dario and Valentin. |
Related to #12208
Status
Description
the module
cgi
has been considered a "dead battery" and removed from python standard library from python 3.13 [1].List of the proposed changes:
src/python/WMCore/WebTools/RESTApi.py
: Removed mentionscgi.FieldStorage
. It is not used anywhere else in the code, I do not see how these lines are still relevant.src/python/WMCore/ReqMgr/Web/utils.py
: the functionquote()
does not seem to be used in this file, I removed it, so that i could remove the import ofcgi
.src/python/WMCore/ReqMgr/Web/tools.py
:cgi.escape()
has been removed since python 3.8 [2] and they suggest to usehtml.escape()
instead. Since we have proper try/except clauses aroundcgi.escape()
, this would not crash our service but emptying some data. Migrating tohtml.escape()
is straightfoward so i just did it. Apparently, we use the functionquote
for jinja templatesWMCore/src/python/WMCore/ReqMgr/Web/tools.py
Line 142 in d335ef6
tools.py:quote()
function? Do you think it's needed in any template? . Or can we remove it in the same way I did forutils.py
and forget abouthtml.escape()
?Is it backward compatible (if not, which system it affects?)
yes
Related PRs
none
External dependencies / deployment changes
none
[1] https://docs.python.org/dev/whatsnew/3.13.html#removed-modules-and-apis
[2]
cgi.escape()
has been removed https://docs.python.org/dev/whatsnew/3.8.html#api-and-feature-removalscgi.escape()
signature https://docs.python.org/3.7/library/cgi.html?highlight=cgi#module-cgihtml.escape()
signature https://docs.python.org/3/library/html.html - identical tocgi.escape()
cgi.escape()
is no longer there https://docs.python.org/3.8/library/cgi.html?highlight=cgi#functions[3] https://github.com/dmwm/WMCore/tree/master/src/html/ReqMgr/jinja_templates