|
|
Subscribe / Log in / New account

Python finally offloads some batteries

Python finally offloads some batteries

Posted Mar 18, 2022 18:49 UTC (Fri) by cjwatson (subscriber, #7322)
In reply to: Python finally offloads some batteries by edgewood
Parent article: Python finally offloads some batteries

The PEP itself has several suggestions (https://peps.python.org/pep-0594/#cgi).


to post comments

Python finally offloads some batteries

Posted Mar 27, 2022 13:53 UTC (Sun) by edgewood (subscriber, #1123) [Link]

I'm so sorry that I missed that. I had skimmed the PEP, and had seen that section, but my eyes got pulled to the code sample at the bottom of the section.

I just had a chance to convert a script that used cgi.FieldStorage to use urllib.parse.parse_qs instead, and it only took me about a half an hour. It helped that I had a helper method to smooth over some weirdness caused by the interaction of FieldStorage and the structure of my existing HTML, and a lot of the accesses of the FieldStorage values already went through that method. I just changed it to access the parse_qs dictionary instead, and changed a handful of sites that directly accessed FieldStorage values directly to call the helper, and it all worked.

My previous plan was to vendor cgi.py, so thank you for responding to my question and pointing me to how I could use supported stdlib code!


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds