Skip to content
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

Replace cgi.FieldStorage with multipart #466

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

luhn
Copy link

@luhn luhn commented Sep 17, 2024

Gets rid of the deprecation warnings and resolves #437

This replaces dependencies on the stdlib cgi for the multipart package, as recommended by PEP-0594

Unfortunately MultiDict exposes FieldStorage objects publicly, and since that's no longer an option I created a new MultiDictFile object that has the same shape. Beyond that, though, FieldStorage is only an implementation detail and can be swapped out cleanly.

There's one test now failing: test_cgi_escaping_fix. It looks to be special handling of a malformed multipart doc, but I can't figure out the motivation for it. It was originally added in d57f294 and the linked repository no longer exists, so the context is lost.

As an aside: FieldStorage is an extremely weird API. The class represents both a single multipart part and the full multipart document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
1 participant