#26508: clean up FieldFile.open documentation
-------------------------------------+-------------------------------------
Reporter: tobias | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by tobias:
Old description:
> 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.
>
> This method also may not be necessary to call except to re-open the file,
> since the underlying file is opened implicitly any time the `file`
> attribute is accessed.
>
> I have a proposed change to the documentation which I will link to after
> I have a ticket number assigned.
New description:
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.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/26508#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.faa15756651b45a638b8ac9f41cfcd52%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.