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

py2/py3: OOo data is binary.

parent ffcffb0c
...@@ -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
class CorruptedOOoFile(Exception): pass class CorruptedOOoFile(Exception): pass
...@@ -137,7 +138,7 @@ class OOoBuilder(Implicit): ...@@ -137,7 +138,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):
""" """
...@@ -145,7 +146,7 @@ class OOoBuilder(Implicit): ...@@ -145,7 +146,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
...@@ -176,7 +177,7 @@ class OOoBuilder(Implicit): ...@@ -176,7 +177,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