#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.

-- 
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/054.5e00e49aa19447b3ea25fcf8a8e2041b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to