On Mon, 2008-12-29 at 18:06 -0800, Ed Summers wrote:
> (my apologies if you already saw this question on django-developers,
> I'm reposting here because it's more a users question)
> 
> I was wondering if anyone else on the list has layered a RESTful
> service into their django applications. I'm adding an atompub
> interface to an existing django project, and I'd like to offer the
> ability to POST and PUT to URIs. Part of my problem is that this
> service needs to handle large (many megabyte) file uploads, so the
> POST and PUT message body needs to be streamed to disk, rather than
> held in memory.
> 
> I took a look at the FileUpload functionality in
> django.http.HttpRequest and
> django.http.multipartparser.MultiPartParser, and it looked like I
> could slot in custom handlers as long as the content was POSTed with a
> mimetype of "multipart/form-data". Unfortunately I am wanting to allow
> clients to POST and PUT arbitrary content (application/zip,
> application/atom+xml, etc).
> 
> At the moment I'm rolling my own code to read from request.environ
> ['wsgi.input'] but I'm worried that I'm not handling everything
> correctly, and am wondering if there exists middleware for handling
> this sort of scenario in a cleaner way. Or perhaps there's a more
> django-y way of doing it?

You're going to have to implement the streaming support yourself in
these cases. Use the existing Django file upload streaming stuff as
inspiration and try to reuse as much as possible, of course, and, if you
find common pieces that can be pulled out to make it easier, posting
patches to Trac would be handy. But this isn't something that's
supported out of the box.

I'd certainly encourage you to look at it, since it's not a bad idea to
be able to do. There's no reason that the streaming support needs to be
tightly coupled to the mime parsing portion (if, indeed, it even is at
the moment). But this is "scratch your own itch" country for sure at the
moment.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to