defnull / multipart

A fast multipart/form-data parser for python
https://multipart.readthedocs.io/
MIT License
135 stars 33 forks source link

Return MultipartPart in any case #1

Closed defnull closed 2 months ago

defnull commented 14 years ago

There is no real (technical or logical) difference between files and forms but a 'filename' attribute. Both can be larger than mem_limit and contain binary data. The parser should return MultipartPart() instances in any case, even if the data was url-encoded, so the user knows what he gets and what to check for.

wobsta commented 14 years ago

forms already contains the decoded values, e.g. (unicode) strings. This is a major difference ... at least right now. I suggest to keep this difference (MultipartPart instance for files and unicode strings for other form fields) and the separation between the two types of return values by the files and forms dicts.

defnull commented 14 years ago

What I do not like at the current implementation is that large forms do raise an exception and there is no way to say "I know this is gonna be big, give me a file object instead".

Think of a forum where an author tries to paste an entire novel into a form field or a scientific application where a biologist pastes a giant genome file into a