file storage should allow saving of basic file-like objects
|Reported by:||Owned by:||anonymous|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||no||Patch needs improvement:||yes|
It is not possible to save file opened by urllib2.urlopen into field of a model.
When trying to do that following way:
f = File(urlopen("http://something.com/somefile.ext").fp)
MODEL.FIELD.save("name.ext", f, save=False)
Django throws AttributeError: '_fileobject' object has no attribute 'seek'
Probeably django\core\files\base.py on line checks if class has attribute seek, but it is being definied at line 125 even when constructor gets an object that does not have such attribute (like urllib2.addinfourl.fp which is socket._fileobject).
Change History (9)
comment:1 Changed 8 years ago by
|Owner:||changed from nobody to anonymous|
|Status:||new → assigned|
comment:4 Changed 8 years ago by
|Patch needs improvement:||set|
|Summary:||It is not possible to save file opened by urllib2.urlopen → file storage should allow saving of basic file-like objects|
|Triage Stage:||Unreviewed → Accepted|
comment:7 Changed 5 years ago by
|Status:||closed → reopened|
|Type:||→ New feature|