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

OOoTemplate: Fix a bug that displaying the source in the ZMI was setting a...

OOoTemplate: Fix a bug that displaying the source in the ZMI was setting a content-disposition header and downloading an OOo document
parent dd94dff5
......@@ -443,6 +443,9 @@ class OOoTemplate(ZopePageTemplate):
return (text, attached_files_dict)
# Proxy method to PageTemplate
def pt_render(self, source=0, extra_context={}):
if source:
return ZopePageTemplate.pt_render(self, source=source,
extra_context=extra_context)
# Get request
request = extra_context.get('REQUEST', self.REQUEST)
# Get parent object (the one to render this template on)
......
......@@ -423,6 +423,36 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
# This untranslatable column have not been translated
self.assertTrue(message not in message_catalog._translated)
def test_form_view_ZMI(self):
"""We can edit form_view in the ZMI."""
response = self.publish('/%s/form_view/manage_main'
% self.portal.getId(), self.auth)
self.assertEqual(HTTP_OK, response.getStatus())
content_type = response.getHeader('content-type')
self.assertEquals('text/html;charset=UTF-8', content_type)
self.assertFalse(response.getHeader('content-disposition'))
# Simplistic assertion that we are viewing the ODF XML source
self.assertTrue('office:document-content' in response.getBody())
def test_form_list_ZMI(self):
"""We can edit form_list in the ZMI."""
response = self.publish('/%s/form_list/manage_main'
% self.portal.getId(), self.auth)
self.assertEqual(HTTP_OK, response.getStatus())
content_type = response.getHeader('content-type')
self.assertEquals('text/html;charset=UTF-8', content_type)
self.assertFalse(response.getHeader('content-disposition'))
self.assertTrue('office:document-content' in response.getBody())
def test_report_view_ZMI(self):
"""We can edit report_view in the ZMI."""
response = self.publish('/%s/report_view/manage_main'
% self.portal.getId(), self.auth)
self.assertEqual(HTTP_OK, response.getStatus())
content_type = response.getHeader('content-type')
self.assertEquals('text/html;charset=UTF-8', content_type)
self.assertFalse(response.getHeader('content-disposition'))
self.assertTrue('office:document-content' in response.getBody())
class TestODTStyle(TestOOoStyle):
skin = 'ODT'
......
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