On 10/27/07, Igor Kovalenko <[EMAIL PROTECTED]> wrote:
>
>
> Hello!
>
> Could somebody tell what I'm doing wrong. I can't post a file in
> django test.
> My code is the following:
>
> path = os.getcwd() + '\\fotogallery\\testfotos\\gfoto1.jpg'
> gf = open(path)
> response = self.client.post('/fotogallery/addgallery/', {'name': 'New
> Gallery 1', 'annotation': 'This is New Gallery
> 1','galleryfilename':gf})
> gf.close()Is the value assigned to 'galleryfilename' really supposed to be an open file object? Just based on the name it sounds more like it should be a string containing the file name. Unfortunately the traceback is useless. Something in your code is causing a 500 error to be raised, but in trying to generate the 500 response page the Django code hits another exception when it cannot find a 500.html template, and that's the traceback you are seeing. To see the traceback associated with the real error try setting DEBUG=True in your test settings file (I assume that works when running under the test framework? If not you'll need a 500.html that Django can find and the proper other settings to have the real root cause traceback emailed to you). Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---

