Thanks for the clarification.  I will definitely look forward to
having file-like objects work this way.  I'll keep my eye out for the
commit.
On Aug 27, 7:23 am, "Marty Alchin" <[EMAIL PROTECTED]> wrote:
> On Wed, Aug 27, 2008 at 12:37 AM, Brian Morton <[EMAIL PROTECTED]> wrote:
> > The docs (and an analysis of the code) indicate that the second
> > argument to save should be the content.
>
> >http://docs.djangoproject.com/en/dev/ref/files/file/#ref-files-file
>
> > I am assuming this is binary or text content to be written to the file
> > in question.  ImageFieldFile calls get_image_dimensions(content) in
> > save, and get_image_dimensions assumes that the input is a file or
> > path that can be open()ed by the file module.
>
> Yeah, looks like the documentation needs to be clearer there, because
> your assumption is incorrect. The "content" argument to
> FieldFile.save() is expected to be a File object itself, since it's
> usually an UploadedFile. There's been talk about updating it to accept
> any file-like object, which I'm working on, but it's not yet
> available.
>
> If you need to pass in raw content like that, you can use
> django.core.files.base.ContentFile to make a suitable File for use
> with .save().
>
> So, yes, there's a mismatch there, but it's the documentation that's
> incomplete in this case.
>
> -Gul
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to