Re: [Django] #9631: FieldFile assumes efficient Storage.size

17 views
Skip to first unread message

Django

unread,
Apr 4, 2013, 6:41:58 PM4/4/13
to django-...@googlegroups.com
#9631: FieldFile assumes efficient Storage.size
-------------------------------------+-------------------------------------
Reporter: psagers | Owner: nobody
Type: | Status: closed
Cleanup/optimization | Version: 1.1-beta
Component: File | Resolution: fixed
uploads/storage | Triage Stage: Design
Severity: Normal | decision needed
Keywords: file upload | Needs documentation: 0
compression | Patch needs improvement: 0
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by jacob):

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


Comment:

I think this was fixed as part of #10300. If that's not true, please
reopen.

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

Django

unread,
Mar 15, 2018, 8:36:08 PM3/15/18
to django-...@googlegroups.com
#9631: FieldFile assumes efficient Storage.size
-------------------------------------+-------------------------------------
Reporter: Peter Sagerson | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: File | Version: 1.11
uploads/storage |
Severity: Normal | Resolution:
Keywords: file upload | Triage Stage: Design
compression | decision needed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Kevin Turner):

* status: closed => new
* cc: Kevin Turner (added)
* version: 1.1-beta => 1.11
* resolution: fixed =>


Comment:

This is still present in Django 1.11.11; FieldFile.size usually delegates
to Storage instead of allowing its File to report (and, at its discretion,
cache) the size:

https://github.com/django/django/blob/1.11.11/django/db/models/fields/files.py#L73

I don't understand what the `if self._committed` is doing in there. Why
wouldn't it be appropriate to return `file.size` whether it's committed or
not? That's the implementation suggested by the initial patch here.

--
Ticket URL: <https://code.djangoproject.com/ticket/9631#comment:8>

Django

unread,
Jan 9, 2019, 5:04:30 PM1/9/19
to django-...@googlegroups.com
#9631: FieldFile assumes efficient Storage.size
-------------------------------------+-------------------------------------
Reporter: Peter Sagerson | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: File | Version: 1.11
uploads/storage |
Severity: Normal | Resolution:
Keywords: file upload | Triage Stage: Design
compression | decision needed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1


Comment:

> Why wouldn't it be appropriate to return file.size whether it's
committed or not? That's the implementation suggested by the initial patch
here.

`self.file` could be `None` unless the file has been opened. But maybe
that check should instead be for `_file`, like the `open()` method. It
looks like the code path for using `file.size` was added for efficiency in
the first place in 68a890e79f6.

--
Ticket URL: <https://code.djangoproject.com/ticket/9631#comment:9>

Django

unread,
Jan 9, 2019, 5:04:47 PM1/9/19
to django-...@googlegroups.com
#9631: FieldFile assumes efficient Storage.size
-------------------------------------+-------------------------------------
Reporter: Peter Sagerson | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: File | Version: 1.11
uploads/storage |
Severity: Normal | Resolution:
Keywords: file upload | Triage Stage: Design
compression | decision needed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Collin Anderson):

* cc: Collin Anderson (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/9631#comment:10>

Reply all
Reply to author
Forward
0 new messages