Opened 8 hours ago
#36974 new Uncategorized
SimpleUploadedFile should support text mode
| Reported by: | Denis Washington | Owned by: | |
|---|---|---|---|
| Component: | File uploads/storage | Version: | 6.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Currently, SimpleUploadedFile requires a bytes-like object to be passed as content, and open() always returns a BytesIO. This makes it useless in contexts where text-mode file-like object is expected. (I hit this issue when trying to pass file.open() to pandas.read_csv(), for instance.)
It would be great if SimpleUploadedFile would alternatively accept a str, in which case open() would then return a StringIO instead.
Note:
See TracTickets
for help on using tickets.