Commit a16bcb52 authored by Nicolas Delaby's avatar Nicolas Delaby

* charset=utf-8 is useless when FormPrintout return binary content

 * now Response headers are overloaded by FormPrintout calling
reviewed by Jerome


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32062 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 14c9a64d
...@@ -242,7 +242,7 @@ class FormPrintout(Implicit, Persistent, RoleManager, Item): ...@@ -242,7 +242,7 @@ class FormPrintout(Implicit, Persistent, RoleManager, Item):
format = REQUEST.get('format', None) format = REQUEST.get('format', None)
if format is None: if format is None:
if REQUEST is not None: if REQUEST is not None:
REQUEST.RESPONSE.setHeader('Content-Type','%s; charset=utf-8' % content_type) REQUEST.RESPONSE.setHeader('Content-Type','%s' % content_type)
REQUEST.RESPONSE.setHeader('Content-disposition', REQUEST.RESPONSE.setHeader('Content-disposition',
'inline;filename="%s%s"' % (self.title_or_id(), guess_extension(content_type))) 'inline;filename="%s%s"' % (self.title_or_id(), guess_extension(content_type)))
return printout return printout
......
...@@ -155,7 +155,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -155,7 +155,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
self.assertTrue(content_xml.find("Foo title!") > 0) self.assertTrue(content_xml.find("Foo title!") > 0)
self.assertEqual(request.RESPONSE.getHeader('content-type'), self.assertEqual(request.RESPONSE.getHeader('content-type'),
'application/vnd.oasis.opendocument.text; charset=utf-8') 'application/vnd.oasis.opendocument.text')
self.assertEqual(request.RESPONSE.getHeader('content-disposition'), self.assertEqual(request.RESPONSE.getHeader('content-disposition'),
'inline;filename="Foo_viewAsPrintout.odt"') 'inline;filename="Foo_viewAsPrintout.odt"')
self._validate(odf_document) self._validate(odf_document)
...@@ -206,8 +206,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -206,8 +206,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
self.assertTrue(content_xml.find("call!") > 0) self.assertTrue(content_xml.find("call!") > 0)
# when just call FormPrintout, it does not change content-type self.assertEqual(request.RESPONSE.getHeader('content-type'), 'application/vnd.oasis.opendocument.text')
self.assertEqual(request.RESPONSE.getHeader('content-type'), 'text/html')
self._validate(odf_document) self._validate(odf_document)
# 5. Normal case: utf-8 string # 5. Normal case: utf-8 string
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment