Commit f8cc0a45 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

py2/py3: OOo data is binary.

parent 082df3de
...@@ -49,6 +49,7 @@ from lxml import etree ...@@ -49,6 +49,7 @@ from lxml import etree
from lxml.etree import Element, XMLSyntaxError from lxml.etree import Element, XMLSyntaxError
from copy import deepcopy from copy import deepcopy
from warnings import warn from warnings import warn
from Products.ERP5Type.Utils import bytes2str
from Products.ERP5Type.Utils import deprecated from Products.ERP5Type.Utils import deprecated
class CorruptedOOoFile(Exception): pass class CorruptedOOoFile(Exception): pass
...@@ -138,7 +139,7 @@ class OOoBuilder(Implicit): ...@@ -138,7 +139,7 @@ class OOoBuilder(Implicit):
return li return li
def getMimeType(self): def getMimeType(self):
return self.extract('mimetype') return bytes2str(self.extract('mimetype'))
def prepareContentXml(self, ooo_xml_file_id): def prepareContentXml(self, ooo_xml_file_id):
""" """
...@@ -146,7 +147,7 @@ class OOoBuilder(Implicit): ...@@ -146,7 +147,7 @@ class OOoBuilder(Implicit):
- add tal namespace - add tal namespace
- indent the xml - indent the xml
""" """
content_xml = self.extract(ooo_xml_file_id) content_xml = bytes2str(self.extract(ooo_xml_file_id))
content_doc = etree.XML(content_xml) content_doc = etree.XML(content_xml)
root = content_doc.getroottree().getroot() root = content_doc.getroottree().getroot()
#Declare zope namespaces #Declare zope namespaces
...@@ -177,7 +178,7 @@ class OOoBuilder(Implicit): ...@@ -177,7 +178,7 @@ class OOoBuilder(Implicit):
def updateManifest(self): def updateManifest(self):
""" Add a path to the manifest """ """ Add a path to the manifest """
MANIFEST_FILENAME = 'META-INF/manifest.xml' MANIFEST_FILENAME = 'META-INF/manifest.xml'
meta_infos = self.extract(MANIFEST_FILENAME) meta_infos = bytes2str(self.extract(MANIFEST_FILENAME))
# prevent some duplicates # prevent some duplicates
for meta_line in meta_infos.split('\n'): for meta_line in meta_infos.split('\n'):
for new_meta_line in self._manifest_additions_list: for new_meta_line in self._manifest_additions_list:
......
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