Commit ccf275b0 authored by Nicolas Delaby's avatar Nicolas Delaby

* Improve consistency use same content_type value to guess filename and to edit

temporary document (When conversion requested). done by kazuhiko

* fix testOOoBatchMode and use a application/vnd.oasis.opendocument.text document as Template
to improve consistency of name of tested OOoTemplate (ERP5Site_viewNothingAsOdt)



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42796 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dac2ad79
...@@ -574,8 +574,9 @@ class OOoTemplate(ZopePageTemplate): ...@@ -574,8 +574,9 @@ class OOoTemplate(ZopePageTemplate):
'Validation of %s failed:\n%s' % (self.getId(), ''.join(err_list))) 'Validation of %s failed:\n%s' % (self.getId(), ''.join(err_list)))
extension = None extension = None
mimetype = ooo_builder.getMimeType()
mimetypes_registry = self.getPortalObject().mimetypes_registry mimetypes_registry = self.getPortalObject().mimetypes_registry
mimetype_object_list = mimetypes_registry.lookup(ooo_builder.getMimeType()) mimetype_object_list = mimetypes_registry.lookup(mimetype)
for mimetype_object in mimetype_object_list: for mimetype_object in mimetype_object_list:
if mimetype_object.extensions: if mimetype_object.extensions:
extension = mimetype_object.extensions[0] extension = mimetype_object.extensions[0]
...@@ -592,7 +593,7 @@ class OOoTemplate(ZopePageTemplate): ...@@ -592,7 +593,7 @@ class OOoTemplate(ZopePageTemplate):
tmp_ooo = newTempOOoDocument(self, self.title_or_id()) tmp_ooo = newTempOOoDocument(self, self.title_or_id())
tmp_ooo.edit(data=ooo, tmp_ooo.edit(data=ooo,
filename=filename, filename=filename,
content_type=self.content_type,) content_type=mimetype,)
format = opts.get('format', request.get('format', None)) format = opts.get('format', request.get('format', None))
if format: if format:
...@@ -600,7 +601,7 @@ class OOoTemplate(ZopePageTemplate): ...@@ -600,7 +601,7 @@ class OOoTemplate(ZopePageTemplate):
# We already have OOo format data, so we do not need to call # We already have OOo format data, so we do not need to call
# convertToBaseFormat(), but just copy it into base_data property. # convertToBaseFormat(), but just copy it into base_data property.
tmp_ooo.setBaseData(ooo) tmp_ooo.setBaseData(ooo)
tmp_ooo.setBaseContentType(self.content_type) tmp_ooo.setBaseContentType(mimetype)
if request is not None and not batch_mode and not source: if request is not None and not batch_mode and not source:
return tmp_ooo.index_html(REQUEST=request, return tmp_ooo.index_html(REQUEST=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