#8501: It is not possible to save file opened by urllib2.urlopen
-------------------------------------------+--------------------------------
Reporter: [EMAIL PROTECTED] | Owner: anonymous
Status: new | Milestone: post-1.0
Component: File uploads/storage | Version: SVN
Resolution: | Keywords: urllib, file
Stage: Unreviewed | Has_patch: 1
Needs_docs: 1 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by daonb <[EMAIL PROTECTED]>):
* status: assigned => new
* needs_docs: 0 => 1
* has_patch: 0 => 1
Comment:
Patch 8501v1.diff supports passing the result of a urlopen as the content
parameter for the save method of FileField and ImageField. Here's the
included testing code:
{{{
>>> obj5 = Storage()
>>> image_data_len =
len(urlopen('http://media.djangoproject.com/img/badges/djangosite80x15.gif').read())
>>>
obj5.image.save('django_logo.gif',urlopen('http://media.djangoproject.com/img/badges/djangosite80x15.gif'))
>>> obj5.image
<ImageFieldFile: tests/django_logo.gif>
>>> image_data_len == obj5.image.size
True
>>> obj5.image.width
80L
>>> obj5.image.height
15L
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/8501#comment:2>
Django <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---