Re: receiving PNG file in django

2016-08-22 Thread Larry Martell
On Mon, Aug 22, 2016 at 12:11 PM, Bill Freeman wrote: > The most appropriate thing is for the source to use the correct content > type, in which case I believe that Django just works (it certainly used to). > But I'm assuming that you can change that. The stuff I suggested were hacks > and as suc

Re: receiving PNG file in django

2016-08-22 Thread Larry Martell
On Mon, Aug 22, 2016 at 11:14 AM, Michal Petrucha wrote: > On Mon, Aug 22, 2016 at 11:10:38AM -0400, Larry Martell wrote: >> On Mon, Aug 22, 2016 at 11:00 AM, Michal Petrucha >> wrote: >> > On Mon, Aug 22, 2016 at 10:11:49AM -0400, Larry Martell wrote: >> >> When I get the request, request.FILES

Re: receiving PNG file in django

2016-08-22 Thread Michal Petrucha
On Mon, Aug 22, 2016 at 11:10:38AM -0400, Larry Martell wrote: > On Mon, Aug 22, 2016 at 11:00 AM, Michal Petrucha > wrote: > > On Mon, Aug 22, 2016 at 10:11:49AM -0400, Larry Martell wrote: > >> When I get the request, request.FILES is empty. Yet the content type > >> is multipart/form-data and t

Re: receiving PNG file in django

2016-08-22 Thread Larry Martell
On Mon, Aug 22, 2016 at 11:00 AM, Michal Petrucha wrote: > On Mon, Aug 22, 2016 at 10:11:49AM -0400, Larry Martell wrote: >> When I get the request, request.FILES is empty. Yet the content type >> is multipart/form-data and the method is POST: >> >> (Pdb) print request.META['CONTENT_TYPE'] >> mult

Re: receiving PNG file in django

2016-08-22 Thread Michal Petrucha
On Mon, Aug 22, 2016 at 10:11:49AM -0400, Larry Martell wrote: > When I get the request, request.FILES is empty. Yet the content type > is multipart/form-data and the method is POST: > > (Pdb) print request.META['CONTENT_TYPE'] > multipart/form-data; > boundary="boundary_.oOo._NzEwNjIzMTM4MTI4NjUx

Re: receiving PNG file in django

2016-08-22 Thread Larry Martell
On Fri, Aug 19, 2016 at 4:58 PM, Bill Freeman wrote: > If the original data truly isn't on the request object somewhere, you might > be able to grab it earlier by writing a request midleware. You might have > to put it pretty early in the chain. > > The first thing to try is changing the content_

Re: receiving PNG file in django

2016-08-22 Thread Larry Martell
When I get the request, request.FILES is empty. Yet the content type is multipart/form-data and the method is POST: (Pdb) print request.META['CONTENT_TYPE'] multipart/form-data; boundary="boundary_.oOo._NzEwNjIzMTM4MTI4NjUxOTM5OQ==MTY2NjE4MDk5Nw==" (Pdb) print request.META['REQUEST_METHOD'] POST

Re: receiving PNG file in django

2016-08-19 Thread Aron Griffis
Hi Larry, I think you'll find what you're looking for in request.FILES, see https://docs.djangoproject.com/en/1.10/ref/request-response/#django.http.HttpRequest.FILES and https://docs.djangoproject.com/en/1.10/ref/files/uploads/#uploaded-files This is the same as using cgi.FieldStorage to parse f

receiving PNG file in django

2016-08-19 Thread Larry Martell
I have a falcon server that I am trying to port to django. One of the falcon endpoints processes a request that contains a PNG file sent with content_type = 'application/octet-stream'. It writes the data to a file maintaining the correct PNG structure. The falcon code does this: form = cgi.FieldS