[Django] #26398: FieldFile open() ignores the mode, always opening the file for reading

4 views
Skip to first unread message

Django

unread,
Mar 22, 2016, 7:48:33 PM3/22/16
to django-...@googlegroups.com
#26398: FieldFile open() ignores the mode, always opening the file for reading
-------------------------------+--------------------
Reporter: koterpillar | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
{{{FieldFile.open}}} has a {{{mode}}} parameter, which is always ignored.
This is a test from the PR:

{{{

def test_filefield_write(self):
# Files can be written to
obj = Storage.objects.create(
normal=SimpleUploadedFile("assignment.txt", b"content"))
with obj.normal as normal:
normal.open('wb')
normal.write(b"updated")
obj = Storage.objects.get()
self.assertEqual(obj.normal.read(), b"updated")

}}}

It fails on at least 1.8 and master with "File not open for writing" on
{{{write()}}}.

Pull request with a fix: https://github.com/django/django/pull/6325

--
Ticket URL: <https://code.djangoproject.com/ticket/26398>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 22, 2016, 8:09:56 PM3/22/16
to django-...@googlegroups.com
#26398: FieldFile open() ignores the mode, always opening the file for reading
-------------------------------------+-------------------------------------

Reporter: koterpillar | Owner: nobody
Type: Uncategorized | Status: new
Component: File | Version: 1.8
uploads/storage |
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
-------------------------------------+-------------------------------------
Changes (by koterpillar):

* needs_better_patch: => 0
* component: Uncategorized => File uploads/storage
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/26398#comment:1>

Django

unread,
Mar 23, 2016, 10:04:52 AM3/23/16
to django-...@googlegroups.com
#26398: FieldFile open() ignores the mode, always opening the file for reading
-------------------------------------+-------------------------------------
Reporter: koterpillar | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: File | Version: 1.8
uploads/storage |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26398#comment:2>

Django

unread,
Mar 23, 2016, 10:45:58 AM3/23/16
to django-...@googlegroups.com
#26398: FieldFile open() ignores the mode, always opening the file for reading
-------------------------------------+-------------------------------------
Reporter: koterpillar | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: File | Version: 1.8
uploads/storage |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"a52a531a8b34f049fba11c3ee7b010af7534bf90" a52a531]:
{{{
#!CommitTicketReference repository=""
revision="a52a531a8b34f049fba11c3ee7b010af7534bf90"
Fixed #26398 -- Made FieldFile.open() respect its mode argument.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26398#comment:3>

Django

unread,
Jun 17, 2016, 9:09:01 PM6/17/16
to django-...@googlegroups.com
#26398: FieldFile open() ignores the mode, always opening the file for reading
-------------------------------------+-------------------------------------
Reporter: koterpillar | Owner: nobody

Type: | Status: closed
Cleanup/optimization |
Component: File | Version: 1.8
uploads/storage |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"7def55c3f6716fcfa40a3bd5d0fbb2090588d81e" 7def55c3]:
{{{
#!CommitTicketReference repository=""
revision="7def55c3f6716fcfa40a3bd5d0fbb2090588d81e"
Reverted "Fixed #26398 -- Made FieldFile.open() respect its mode
argument."

This reverts commit a52a531a8b34f049fba11c3ee7b010af7534bf90 due to
regressions described in refs #26772.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26398#comment:4>

Django

unread,
Jun 17, 2016, 9:12:44 PM6/17/16
to django-...@googlegroups.com
#26398: FieldFile open() ignores the mode, always opening the file for reading
-------------------------------------+-------------------------------------
Reporter: koterpillar | Owner: nobody

Type: | Status: closed
Cleanup/optimization |
Component: File | Version: 1.8
uploads/storage |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"bdc29b7188af0cda31a2e37759236d06d996eb44" bdc29b7]:
{{{
#!CommitTicketReference repository=""
revision="bdc29b7188af0cda31a2e37759236d06d996eb44"
[1.10.x] Reverted "Fixed #26398 -- Made FieldFile.open() respect its mode
argument."

This reverts commit a52a531a8b34f049fba11c3ee7b010af7534bf90 due to
regressions described in refs #26772.

Backport of 7def55c3f6716fcfa40a3bd5d0fbb2090588d81e from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26398#comment:5>

Django

unread,
Jun 17, 2016, 9:22:00 PM6/17/16
to django-...@googlegroups.com
#26398: FieldFile open() ignores the mode, always opening the file for reading
--------------------------------------+------------------------------------
Reporter: koterpillar | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: File uploads/storage | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* status: closed => new
* has_patch: 1 => 0
* resolution: fixed =>
* stage: Ready for checkin => Accepted


Comment:

As noted in the commits above, we had to revert this fix due to some
regressions reported in #26772.

--
Ticket URL: <https://code.djangoproject.com/ticket/26398#comment:6>

Django

unread,
Aug 9, 2016, 12:39:20 PM8/9/16
to django-...@googlegroups.com
#26398: FieldFile open() ignores the mode, always opening the file for reading
-------------------------------------+-------------------------------------
Reporter: koterpillar | Owner: nobody

Type: | Status: closed
Cleanup/optimization |
Component: File | Version: 1.8
uploads/storage |
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => duplicate


Comment:

Duplicate of #13809

--
Ticket URL: <https://code.djangoproject.com/ticket/26398#comment:7>

Reply all
Reply to author
Forward
0 new messages