diff --git a/product/ERP5OOo/transforms/html_to_odt.py b/product/ERP5OOo/transforms/html_to_odt.py index db41f0e9da9f1adc9c19a1a8796965e536864c63..19b71e5b9c6c8b4c165a221a7384feb890029708 100644 --- a/product/ERP5OOo/transforms/html_to_odt.py +++ b/product/ERP5OOo/transforms/html_to_odt.py @@ -45,7 +45,6 @@ class HTMLToOdt: orig = html.tostring(html_tree, encoding='utf-8') doc = OOOdCommandTransform(context, filename, orig, self.inputs[0]) - doc.convert() odt = doc.convertTo('odt') if cache is not None: cache.setData(odt) diff --git a/product/ERP5OOo/transforms/odt_to_doc.py b/product/ERP5OOo/transforms/odt_to_doc.py index 0c17035add4c95765e2a2191c081ac12d4587334..dbc5a20ab5a039c6f4dcacf228f8832df184ae06 100644 --- a/product/ERP5OOo/transforms/odt_to_doc.py +++ b/product/ERP5OOo/transforms/odt_to_doc.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from Products.PortalTransforms.interfaces import itransform from zope.interface import implements from oood_commandtransform import OOOdCommandTransform, OOoDocumentDataStream @@ -28,7 +29,6 @@ class OdtToDoc: def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs): data = str(orig) doc = OOOdCommandTransform(context, filename, data, self.inputs[0]) - doc.convert() msword = doc.convertTo('doc') if cache is not None: cache.setData(msword) diff --git a/product/ERP5OOo/transforms/odt_to_pdf.py b/product/ERP5OOo/transforms/odt_to_pdf.py index 6de9e5b20ce78027a606644f975937f838e58fbf..5476bc9ad724d5b3e240d334e76c93ce37564aed 100644 --- a/product/ERP5OOo/transforms/odt_to_pdf.py +++ b/product/ERP5OOo/transforms/odt_to_pdf.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from Products.PortalTransforms.interfaces import itransform from zope.interface import implements from oood_commandtransform import OOOdCommandTransform, OOoDocumentDataStream @@ -28,7 +29,6 @@ class OdtToPdf: def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs): data = str(orig) doc = OOOdCommandTransform(context, filename, data, self.inputs[0]) - doc.convert() pdf = doc.convertTo('pdf') if cache is not None: cache.setData(pdf) diff --git a/product/ERP5OOo/transforms/odt_to_xml.py b/product/ERP5OOo/transforms/odt_to_xml.py index a16effc1e5d6ebeb32a1b28ebdc8f32cdd61a300..447ca340a8383d916de54b47de2a5b775e8f53a6 100644 --- a/product/ERP5OOo/transforms/odt_to_xml.py +++ b/product/ERP5OOo/transforms/odt_to_xml.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from Products.PortalTransforms.interfaces import itransform from zope.interface import implements from oood_commandtransform import OOOdCommandTransform, OOoDocumentDataStream @@ -29,7 +30,6 @@ class OdtToXml: def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs): data = str(orig) doc = OOOdCommandTransform(context, filename, data, self.inputs[0]) - doc.convert() builder = OOoBuilder(doc) content = builder.extract('content.xml') if cache is not None: diff --git a/product/ERP5OOo/transforms/oood_commandtransform.py b/product/ERP5OOo/transforms/oood_commandtransform.py index 3eaad1bd4c6a3cf51862920fa77e50ba45ef59d4..f1737b161bd827092148054ff3dc3ae80140126a 100644 --- a/product/ERP5OOo/transforms/oood_commandtransform.py +++ b/product/ERP5OOo/transforms/oood_commandtransform.py @@ -68,7 +68,14 @@ class OOOdCommandTransform(commandtransform): self.context = context if self.mimetype == 'text/html': data = self.includeExternalCssList(data) - self.data = data + tmp_ooo = newTempOOoDocument(context, name) + tmp_ooo.edit( data=data, + fname=self.name(), + source_reference=self.name(), + filename=self.name(), + content_type=self.mimetype,) + tmp_ooo.convertToBaseFormat() + self.ooo = tmp_ooo def name(self): return self.__name__ @@ -186,18 +193,6 @@ class OOOdCommandTransform(commandtransform): return etree.tostring(xml_doc, encoding='utf-8', xml_declaration=False, pretty_print=False, ) - def convert(self): - tmp_ooo = newTempOOoDocument(self.context, self.name()) - # XXX We store the same content inside data and base_data - # otherwise conversion server fails to convert html=>odt for example. - # deeper investigation is required inside oood to understand this issue. - tmp_ooo.edit( base_data=self.data, - fname=self.name(), - source_reference=self.name(), - base_content_type=self.mimetype, - content_type=self.mimetype,) - self.ooo = tmp_ooo - def convertTo(self, format): if self.ooo.isTargetFormatAllowed(format): mime, data = self.ooo.convert(format)