Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix versioning in py3 #52

Merged
merged 2 commits into from
Apr 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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