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

py2/py3: OOo data is binary.

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