Commit d0b5b983 authored by Jérome Perrin's avatar Jérome Perrin

fixup! fixup! fixup! fixup! fixup! XMLExportImport: more support pickle...

fixup! fixup! fixup! fixup! fixup! XMLExportImport: more support pickle protocol 3 🚧 ( repair python2 )
parent 3cb97d48
Pipeline #33953 failed with stage
in 0 seconds
...@@ -52,8 +52,7 @@ class XMLPickleTestCase(unittest.TestCase): ...@@ -52,8 +52,7 @@ class XMLPickleTestCase(unittest.TestCase):
pickled_string = pickle.dumps(obj, protocol=self._pickle_protocol) pickled_string = pickle.dumps(obj, protocol=self._pickle_protocol)
f = BytesIO(pickled_string) f = BytesIO(pickled_string)
xml = ppml.ToXMLUnpickler(f).load().__str__() xml = ppml.ToXMLUnpickler(f).load().__str__()
if six.PY2 and isinstance(xml, six.text_type): self.assertIsInstance(xml, str)
xml = xml.encode('utf-8')
return xml return xml
def load_from_xml(self, xml_string, persistent_load=None): def load_from_xml(self, xml_string, persistent_load=None):
......
...@@ -32,7 +32,7 @@ import re ...@@ -32,7 +32,7 @@ import re
from marshal import loads as mloads from marshal import loads as mloads
from .xyap import NoBlanks from .xyap import NoBlanks
from .xyap import xyap from .xyap import xyap
from Products.ERP5Type.Utils import str2bytes, bytes2str from Products.ERP5Type.Utils import bytes2str, str2bytes, unicode2str
from marshal import dumps as mdumps from marshal import dumps as mdumps
...@@ -210,6 +210,9 @@ class Unicode(String): ...@@ -210,6 +210,9 @@ class Unicode(String):
return 'string' return 'string'
return super(Unicode, self).tag_name() return super(Unicode, self).tag_name()
def value(self):
return unicode2str(super(Unicode, self).value())
class Bytes(String): class Bytes(String):
pass pass
......
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