Remove cgi.FieldStorage (based on #769) by scottbarnes · Pull Request #773 · webpy/webpy

@scottbarnes

@scottbarnes

mekarpeles

d = d.encode("utf-8")
fp = BytesIO(d)
a = cgiFieldStorage(fp=fp, environ=e, keep_blank_values=1)
post_data = data().decode("utf-8")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making sure we're not accidentally losing anything in this decode (or hitting any other unexpected results)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mekarpeles

return fs.value
env["REQUEST_METHOD"] = "GET"
b = dict(
urllib.parse.parse_qs(env.get("QUERY_STRING", ""), keep_blank_values=True)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: QUERY_STRING previously handled within cgiFieldStorage constructor.

@mekarpeles

cclauss

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks, @tfmorris, @scottbarnes, @mekarpeles for the collaboration.

Monday Python 3.12 should ship.
One year from Monday Python 3.12 should ship and web.py should be ready. ;-)

tfmorris

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This had been merged by the time I saw the ping requesting review, so I didn't bother, but circling back to do a post-hoc review now since there was an issue with it.

Comment on lines +427 to +428

"_fieldstorage"
) # TODO: Rename? is this visible anywhere else?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually manipulated by the OpenLibrary code, as I remember. Instead of exposing this, nominally internal, name, a better method might be to introduce a clear_cache() function or some such to encapsulate this.

d = d.encode("utf-8")
fp = BytesIO(d)
a = cgiFieldStorage(fp=fp, environ=e, keep_blank_values=1)
post_data = data().decode("utf-8")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cclauss

This was referenced

Apr 29, 2024