Recently I've encountered the following error:
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py",
line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py",
line 1229, in _process_target
result = _execute_target(config, req, object, arg)
File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py",
line 1128, in _execute_target
result = object(arg)
File "/usr/local/lib/python2.5/site-packages/django/core/handlers/
modpython.py", line 178, in handler
return ModPythonHandler()(req)
File "/usr/local/lib/python2.5/site-packages/django/core/handlers/
modpython.py", line 161, in __call__
req.content_type = response['Content-Type']
TypeError: content_type must be a string
----------------------------------------------------------------------
This is my view code that returns the response, which produces this error:
-------------------------------------------------------------------------
response = HttpResponse(file_data)
response['Content-Type'] = u'application/%s' % f
response['Content-Disposition'] = u'attachment; filename="%s.%s"' % (t, f)
return response
-------------------------------------------------------------------------
'f' variable can be: 'zip', 'pdf', 'rtf', 'doc'. And when I print response
['Content-Type'], I see 'application/(f)' so I know that I pass it to
Django as I'd expect. Has something changed recently in Django that could
affect this code? This was working before.
It could be mod_python or Apache error, not specific to Django, but I'm
not sure. But perhaps, there's something I'm doing wrong.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---