Commit 6b5643a3 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Arnaud Fontaine

XMLExportImport: Base_asXML and Folder_asXML return str, not bytes.

parent b8677963
...@@ -55,7 +55,7 @@ else: ...@@ -55,7 +55,7 @@ else:
from base64 import standard_b64encode, encodebytes from base64 import standard_b64encode, encodebytes
from hashlib import sha1 from hashlib import sha1
from Products.ERP5Type.Utils import ensure_list from Products.ERP5Type.Utils import bytes2str
#from zLOG import LOG #from zLOG import LOG
try: try:
...@@ -209,8 +209,8 @@ def Base_asXML(object, root=None): ...@@ -209,8 +209,8 @@ def Base_asXML(object, root=None):
local_group_node.append(marshaller(group_role[1])) local_group_node.append(marshaller(group_role[1]))
if return_as_object: if return_as_object:
return root return root
return etree.tostring(root, encoding='utf-8', return bytes2str(etree.tostring(root, encoding='utf-8',
xml_declaration=True, pretty_print=True) xml_declaration=True, pretty_print=True))
def Folder_asXML(object, omit_xml_declaration=True, root=None): def Folder_asXML(object, omit_xml_declaration=True, root=None):
""" """
...@@ -231,8 +231,8 @@ def Folder_asXML(object, omit_xml_declaration=True, root=None): ...@@ -231,8 +231,8 @@ def Folder_asXML(object, omit_xml_declaration=True, root=None):
if issubclass(o.__class__, Base): if issubclass(o.__class__, Base):
o.asXML(root=root_node) o.asXML(root=root_node)
return etree.tostring(root, encoding='utf-8', return bytes2str(etree.tostring(root, encoding='utf-8',
xml_declaration=xml_declaration, pretty_print=True) xml_declaration=xml_declaration, pretty_print=True))
## The code below was initially from OFS.XMLExportImport ## The code below was initially from OFS.XMLExportImport
from six import string_types as basestring from six import string_types as basestring
......
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