--
Ticket URL: <https://code.djangoproject.com/ticket/18283>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/18283#comment:1>
* owner: nobody => szopu
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/18283#comment:2>
* owner: szopu => trg
--
Ticket URL: <https://code.djangoproject.com/ticket/18283#comment:3>
Comment (by trg):
I have a real trouble with reproducing this bug. The description of it is
very enigmatic - the submitter didn't mention what
`do_something_with_image()` actually does (for instance, what type of
object it returns).
This bug seems to happen only when one takes the `FieldFile` object from
specified model field and modifies it in place. This is illustrated by
`test_unchanged_fieldfile` in the diff below:
https://github.com/django/django/compare/master...szopu:ticket_18283?expand=1
The only way I see this problem can be fixed, is defensive shallow copying
of the `FieldFile` object in `__get__` and `__set__` (I think that doing
it for `__set__` only is not enough). But this solution has a downside,
for instance, this would generate following semantics:
{{{#!python
model.myfile.name = 'somefile.txt'
print(model.myfile.name) # returns the previous filename instead of
'somefile.txt'
}}}
So my question is: Is it the right way to go?
--
Ticket URL: <https://code.djangoproject.com/ticket/18283#comment:4>