#26367: Assess if FieldFile can work with stdlib File instead of requiring
Django's
File
--------------------------------------+------------------------------------
Reporter: cristianocca | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: File uploads/storage | Version: 1.9
Severity: Normal | Resolution:
Keywords: file storage | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by cristianocca):
Hey Tim, thanks for the quick change for _size.
The requirement of File might be even more difficult to confirm, even if
it is not a requirement for the django implementation, what if other
people's own storage relies on it? Still there doesn't seem to be any
checks for File on the save method so it is either blowing up already for
people using normal files or everyone is guarded with a File object. So
maybe as long as it works fine with django we shouldn't worry about other
people's storages.
It seems like the File object is required at FieldFile for its open method
and size property which is not present on regular files. However, if the
FieldFile.save method handled the conversion to File of content, it should
work fine from there, removing the requierement that the .save method is
always called with a File object. Other requierements of File would still
apply ( for all the storage class methods) but it would definetly make
saving files less verbose.
Looking at the save method is it possible that it also has an issue? After
saving, the current 'cached' file instance is never refrshed, only the
file name of the instance:
https://github.com/django/django/blob/f15f4b8bb6f45dfdcb74f71e8dcc30c0aaa6ac80/django/db/models/fields/files.py#L89
--
Ticket URL: <https://code.djangoproject.com/ticket/26367#comment:4>
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/070.faa9582064d178944c6e4e6898eb804b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.