Commit c4183e0c authored by Jérome Perrin's avatar Jérome Perrin

format is sometimes passed as an empty string, in this case, don't proceed to...

format is sometimes passed as an empty string, in this case, don't proceed to conversion, but make sure headers are corrects



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16077 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 64b290ff
...@@ -483,7 +483,7 @@ xmlns:config="http://openoffice.org/2001/config" office:version="1.0"> ...@@ -483,7 +483,7 @@ xmlns:config="http://openoffice.org/2001/config" office:version="1.0">
if format: if format:
return self._asFormat(ooo, format, request, batch_mode) return self._asFormat(ooo, format, request, batch_mode)
if format is None and not batch_mode: if not format and not batch_mode:
request.RESPONSE.setHeader('Content-Type','%s;; charset=utf-8' % self.content_type) request.RESPONSE.setHeader('Content-Type','%s;; charset=utf-8' % self.content_type)
request.RESPONSE.setHeader('Content-disposition', 'inline;filename=%s' % self.title_or_id()) request.RESPONSE.setHeader('Content-disposition', 'inline;filename=%s' % self.title_or_id())
else: else:
......
...@@ -78,6 +78,16 @@ class TestOoodResponse(ERP5TypeTestCase): ...@@ -78,6 +78,16 @@ class TestOoodResponse(ERP5TypeTestCase):
request.RESPONSE.getHeader('content-type').split(';')[0]) request.RESPONSE.getHeader('content-type').split(';')[0])
self.assertEqual('inline;filename=ERP5Site_viewNothingAsOdt', self.assertEqual('inline;filename=ERP5Site_viewNothingAsOdt',
request.RESPONSE.getHeader('content-disposition')) request.RESPONSE.getHeader('content-disposition'))
def test_01b_noExcEmptyFormatNoBatchMode(self):
request = self.portal.REQUEST
request.RESPONSE.setHeader('content-type', 'text/html')
ERP5Site_viewNothingAsOdt = self.getPortal().ERP5Site_viewNothingAsOdt
ERP5Site_viewNothingAsOdt(format='', batch_mode=0)
self.assertEqual('application/vnd.oasis.opendocument.text',
request.RESPONSE.getHeader('content-type').split(';')[0])
self.assertEqual('inline;filename=ERP5Site_viewNothingAsOdt',
request.RESPONSE.getHeader('content-disposition'))
def test_02_noExcNoFormatBatchMode(self): def test_02_noExcNoFormatBatchMode(self):
request = self.portal.REQUEST request = self.portal.REQUEST
......
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