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

XMLExportImport: Base_asXML and Folder_asXML return str, not bytes.

parent ba5e5ad0
...@@ -209,7 +209,7 @@ def Base_asXML(object, root=None): ...@@ -209,7 +209,7 @@ 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 etree.tostring(root, encoding='unicode' if six.PY3 else '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,7 +231,7 @@ def Folder_asXML(object, omit_xml_declaration=True, root=None): ...@@ -231,7 +231,7 @@ 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 etree.tostring(root, encoding='unicode' if six.PY3 else '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
......
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