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)
Change History (9)
by , 13 years ago
Attachment: | tests.diff added |
---|
comment:1 by , 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 , 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 , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
It should probably only reopen (as opposed to seeking) if the mode is changed, patch is correct in principle.
comment:5 by , 13 years ago
Needs tests: | set |
---|
Tests that demonstrate the bug