You can create a Django file object from any file-like object just by
passing it to the constructor.

django.core.files.File(my_file_like_object)

This is basically what all the storage backends do where there is an
existing file object from whatever source, and what you have to do if you
want to save an existing file to a FileField.

- ojno

On 28 February 2012 22:28, Michael <michael.palumb...@gmail.com> wrote:

> Hi,
>
> The File Storage API only works with the Django File object (https://
> docs.djangoproject.com/en/1.3/ref/files/storage/ ;
> https://docs.djangoproject.com/en/1.3/ref/files/file/).
> Wouldn't it be a good idea to make a Django file-like object instead
> and make the Storage API works with it ?
> That way we could use the current Django File object when it is real
> files but also use a "remote" file object like the urllib2.urlopen
> returns.
>
> What do you think ?
>
> Best,
> Michael
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-developers@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to