diff --git a/CHANGES.rst b/CHANGES.rst index 6cfc66e4..6f11609f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -29,7 +29,7 @@ New features: Bug fixes: - Make imports Python 3 compatible - [ale-rt] + [ale-rt, pbauer] - Don't depend on ZODB version 3 directly [tomgross] diff --git a/Products/CMFEditions/ArchivistTool.py b/Products/CMFEditions/ArchivistTool.py index fa16050b..1771152d 100644 --- a/Products/CMFEditions/ArchivistTool.py +++ b/Products/CMFEditions/ArchivistTool.py @@ -54,7 +54,7 @@ from Products.CMFEditions.utilities import dereference from Products.CMFEditions.utilities import KwAsAttributes -from six import StringIO +from six import BytesIO from six.moves.cPickle import Pickler from six.moves.cPickle import Unpickler from zope.interface import alsoProvides @@ -70,7 +70,7 @@ def deepcopy(obj): """Makes a deep copy of the object using the pickle mechanism. """ - stream = StringIO() + stream = BytesIO() p = Pickler(stream, 1) p.dump(aq_base(obj)) stream.seek(0) @@ -219,7 +219,7 @@ def _cloneByPickle(self, obj): else: inside_orefs, outside_orefs = (), () - stream = StringIO() + stream = BytesIO() p = Pickler(stream, 1) if callbacks is not None: p.persistent_id = pers_id diff --git a/Products/CMFEditions/ZVCStorageTool.py b/Products/CMFEditions/ZVCStorageTool.py index 74ae4118..47fcaa79 100644 --- a/Products/CMFEditions/ZVCStorageTool.py +++ b/Products/CMFEditions/ZVCStorageTool.py @@ -54,7 +54,7 @@ from Products.ZopeVersionControl.Utility import VersionControlError from Products.ZopeVersionControl.ZopeRepository import ZopeRepository -from six import StringIO +from six import BytesIO from six.moves.cPickle import dumps from six.moves.cPickle import HIGHEST_PROTOCOL from six.moves.cPickle import loads @@ -70,7 +70,7 @@ logger = logging.getLogger('CMFEditions') def deepCopy(obj): - stream = StringIO() + stream = BytesIO() p = Pickler(stream, 1) p.dump(obj) stream.seek(0) @@ -120,7 +120,7 @@ def getSize(obj): try: # fallback: pickling the object - stream = StringIO() + stream = BytesIO() p = Pickler(stream, 1) p.dump(obj) size = stream.tell() @@ -521,11 +521,11 @@ def _encodeMetadata(self, metadata): comment = dumps(comment) except KeyError: comment = '' - return '\x00\n'.join((comment, dumps(metadata, HIGHEST_PROTOCOL))) + return b'\x00\n'.join((comment, dumps(metadata, HIGHEST_PROTOCOL))) def _retrieveMetadataFromZVC(self, zvc_histid, zvc_selector): logEntry = self._retrieveZVCLogEntry(zvc_histid, zvc_selector) - metadata = loads(logEntry.message.split('\x00\n', 1)[1]) + metadata = loads(logEntry.message.split(b'\x00\n', 1)[1]) return metadata diff --git a/Products/CMFEditions/tests/DummyTools.py b/Products/CMFEditions/tests/DummyTools.py index 6737a14e..1652d63b 100644 --- a/Products/CMFEditions/tests/DummyTools.py +++ b/Products/CMFEditions/tests/DummyTools.py @@ -19,7 +19,7 @@ from Products.CMFEditions.interfaces.IStorage import IStreamableReference from Products.CMFEditions.utilities import dereference -from six import StringIO +from six import BytesIO from six.moves.cPickle import Pickler from six.moves.cPickle import Unpickler from zope.interface import implementer @@ -52,7 +52,7 @@ def getId(self): return self.id def deepCopy(obj): - stream = StringIO() + stream = BytesIO() p = Pickler(stream, 1) p.dump(obj) stream.seek(0)