clean up FieldFile.open documentation
The documentation for FieldFile.open
claims that it behaves like the standard Python open()
method, which is incorrect. It does not return a file descriptor the way the Python method does.
It is also unnecessary to call the open
method except to re-open the file or change the mode, since the underlying file is opened implicitly any time the file
attribute is accessed.
Finally, I found it surprising that two methods in this class default to also saving the model object (associated with the FileField
associated with the FieldFile
that is being saved or deleted). I added a louder warning about this -- I would rather be reminded twice than spend time trying to figure out how and why my model instance is being saved before I wanted it to be.
Change History
(8)
Description: |
modified (diff)
|
Summary: |
FieldFile.open documentation incorrect → clean up FieldFile.open documentation
|
Has patch: |
set
|
Triage Stage: |
Unreviewed → Accepted
|
Triage Stage: |
Accepted → Ready for checkin
|
Patch needs improvement: |
set
|
Triage Stage: |
Ready for checkin → Accepted
|
Patch needs improvement: |
unset
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
Pull request here: https://github.com/django/django/pull/6459