Re: Testing uploads and content types

2009-01-23 Thread Julien Phalip
On Jan 24, 12:57 pm, Malcolm Tredinnick wrote: > On Fri, 2009-01-23 at 12:15 -0800, Julien Phalip wrote: > > On Jan 24, 2:45 am, varikin wrote: > > > The UploadedFile[1] object has a field called content_type. So if you > > > have this in a form: > > > > myfile = request.FILES['some_file'] > > >

Re: Testing uploads and content types

2009-01-23 Thread Malcolm Tredinnick
On Fri, 2009-01-23 at 12:15 -0800, Julien Phalip wrote: > On Jan 24, 2:45 am, varikin wrote: > > The UploadedFile[1] object has a field called content_type. So if you > > have this in a form: > > > > myfile = request.FILES['some_file'] > > if myfile.content_type != 'application/zip': > > #ra

Re: Testing uploads and content types

2009-01-23 Thread Julien Phalip
On Jan 24, 2:45 am, varikin wrote: > The UploadedFile[1] object has a field called content_type. So if you > have this in a form: > > myfile = request.FILES['some_file'] > if myfile.content_type != 'application/zip': >      #raise error > > I don't know if this will help you in your test. I hope

Re: Testing uploads and content types

2009-01-23 Thread varikin
On Jan 23, 1:39 am, Julien Phalip wrote: > I have a view which processes a multi-part form and whose behaviour > varies depending on the content types of the uploaded files. I've > written some tests for that view as follows: > >         post_data = { >             'name1': 'blah', >            

Testing uploads and content types

2009-01-22 Thread Julien Phalip
Hi, I have a view which processes a multi-part form and whose behaviour varies depending on the content types of the uploaded files. I've written some tests for that view as follows: post_data = { 'name1': 'blah', 'file_field1': image_data, } respo