Opened 13 years ago

Closed 13 years ago

#16964 closed Bug (duplicate)

FileField files can't be opened in write mode if not closed before

Reported by: Jonas H. Owned by: nobody
Component: File uploads/storage Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The File associated with a FileField in a model object fetched from the db can't be opened in non-read mode. Test case and patch attached.

Attachments (2)

tests.diff (1.4 KB ) - added by Jonas H. 13 years ago.
Tests that demonstrate the bug
patch.diff (565 bytes ) - added by Jonas H. 13 years ago.
Patch that fixes the bug

Download all attachments as: .zip

Change History (9)

by Jonas H., 13 years ago

Attachment: tests.diff added

Tests that demonstrate the bug

by Jonas H., 13 years ago

Attachment: patch.diff added

Patch that fixes the bug

comment:1 by Preston Holmes, 13 years ago

I haven't had time to play with the attached tests to verify the bug, but at a minimum, the attached patch would break the documented behavior:

https://docs.djangoproject.com/en/dev/ref/files/file/#django.core.files.File.open

comment:2 by Jonas H., 13 years ago

Why? The current behaviour doesn't match the docs: The file isn't reopened in a different mode although the explicit call to .open.

comment:3 by Alex Gaynor, 13 years ago

Triage Stage: UnreviewedAccepted

It should probably only reopen (as opposed to seeking) if the mode is changed, patch is correct in principle.

comment:4 by anonymous, 13 years ago

bump

comment:5 by Jannis Leidel, 13 years ago

Needs tests: set

comment:6 by anonymous, 13 years ago

already has tests, what's missing?

comment:7 by Claude Paroz, 13 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #13809

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