Skip to content

Commit

Permalink
Merge pull request #52 from plone/python3
Browse files Browse the repository at this point in the history
Fix versioning in py3
  • Loading branch information
jensens authored Apr 4, 2018
2 parents 8478179 + 5fa0d08 commit fcdb2d1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions Products/CMFEditions/ArchivistTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions Products/CMFEditions/ZVCStorageTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions Products/CMFEditions/tests/DummyTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fcdb2d1

Please sign in to comment.