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()

In urls.py I have:

(r'^addgallery/$', 'add_gallery'),

I've got following error:

ERROR: test_addMainGallery (shalamov.fotogallery.tests.SimpleTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Program Files\Apache Software Foundation\Apache2.2\www\docs
\shalamov\
..\shalamov\fotogallery\tests.py", line 56, in test_addMainGallery
    response = self.client.post('/fotogallery/addgallery/', {'name':
'New Galler
y 1', 'annotation': 'This is New Gallery 1','galleryfilename':gf})
  File "C:\Python25\lib\site-packages\django\test\client.py", line
216, in post
    return self.request(**r)
  File "C:\Python25\lib\site-packages\django\test\client.py", line
156, in reque
st
    response = self.handler(environ)
  File "C:\Python25\lib\site-packages\django\test\client.py", line 34,
in __call
__
    response = self.get_response(request)
  File "C:\Python25\lib\site-packages\django\core\handlers\base.py",
line 126, i
n get_response
    return callback(request, **param_dict)
  File "C:\Python25\lib\site-packages\django\views\defaults.py", line
88, in ser
ver_error
    t = loader.get_template(template_name) # You need to create a
500.html templ
ate.
  File "C:\Python25\lib\site-packages\django\template\loader.py", line
79, in ge
t_template
    source, origin = find_template_source(template_name)
  File "C:\Python25\lib\site-packages\django\template\loader.py", line
72, in fi
nd_template_source
    raise TemplateDoesNotExist, name
TemplateDoesNotExist: 500.html

The code works fine without the file.
And the most interesting my view works fine with django-server - files
correctly are uploaded.
Only test doesn't work


--~--~---------~--~----~------------~-------~--~----~
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