FileSystemStorage.save should support any file-like objects
|Reported by:||Vlastimil Zíma||Owned by:||Marcin Biernat|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I propose generic support of
content argument can be any object with
I see no reason why
FileSystemStorage does not support regular file-like objects. IT is common practise to support any file-like objects in python libraries, where file-like object is an argument.
Blocker of this is
content.chunks() call which itself is nothing else then generator over
file.read(chunk_size). Storage itself could easily call
content.read(chunk_size) directly which grants support to various file-like objects.
Calls like this are just weird:
File objects is here only because it has
chunks() method required by
I have seen #8204 but I do not require anything so specific. It is just painful, when you want to use storage for anything else than file from query or form.
Change History (10)
comment:1 Changed 4 years ago by
|Triage Stage:||Unreviewed → Accepted|
|Type:||Uncategorized → Cleanup/optimization|
comment:5 Changed 4 years ago by
|Owner:||changed from nobody to Marcin Biernat|
|Status:||new → assigned|