Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#26508 closed Cleanup/optimization (fixed)

clean up FieldFile.open documentation

Reported by: Tobias McNulty Owned by: nobody
Component: Documentation Version: 1.9
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tobias McNulty)

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)

comment:1 Changed 5 years ago by Tobias McNulty

comment:2 Changed 5 years ago by Tobias McNulty

Description: modified (diff)
Summary: FieldFile.open documentation incorrectclean up FieldFile.open documentation

comment:3 Changed 5 years ago by Tim Graham

Has patch: set
Triage Stage: UnreviewedAccepted

comment:4 Changed 5 years ago by Tim Graham

Triage Stage: AcceptedReady for checkin

comment:5 Changed 5 years ago by Tim Graham

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

comment:6 Changed 5 years ago by Tim Graham

Patch needs improvement: unset

comment:7 Changed 5 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In dbd99de:

Fixed #26508 -- Clarified docs for various FieldFile methods.

comment:8 Changed 5 years ago by Tim Graham <timograham@…>

In d2dc188:

[1.9.x] Fixed #26508 -- Clarified docs for various FieldFile methods.

Backport of dbd99de6fa006798ca81ef43cbc83d88e5e6a377 from master

Note: See TracTickets for help on using tickets.
Back to Top