Commit 0e25e258 authored by Jérome Perrin's avatar Jérome Perrin

persistent_migration: py3

parent 4a97c3e8
......@@ -42,6 +42,9 @@ from persistent import Persistent, wref
from ZODB.serialize import ObjectWriter, ObjectReader
from Products.ERP5Type import Permissions
from Products.ERP5Type.Base import Base, TempBase, WorkflowMethod
from zodbpickle import binary
import six
log = logging.getLogger('ERP5Type')
log.trace = lambda *args, **kw: log.log(5, *args, **kw)
......@@ -96,7 +99,6 @@ class PickleUpdater(ObjectReader, ObjectWriter, object):
if _setOb:
if isinstance(_setOb, WorkflowMethod):
_setOb = _setOb._m
import six
if six.get_unbound_function(_setOb) is six.get_unbound_function(OFS_Folder._setOb):
self.lazy = Ghost
elif klass.__module__[:7] == 'BTrees.' and klass.__name__ != 'Length':
......@@ -112,9 +114,9 @@ class PickleUpdater(ObjectReader, ObjectWriter, object):
def find_global(*args):
self.do_migrate = args != (klass.__module__, klass.__name__) and \
not isOldBTree('%s.%s' % args)
unpickler.find_global = self._get_class
unpickler.find_global = unpickler.find_class = self._get_class
return self._get_class(*args)
unpickler.find_global = find_global
unpickler.find_global = unpickler.find_class = find_global
unpickler.load() # class
state = unpickler.load()
if isinstance(self.lazy, LazyPersistent):
......@@ -152,7 +154,7 @@ class PickleUpdater(ObjectReader, ObjectWriter, object):
def persistent_id(self, obj):
assert type(obj) is not Ghost
oid = self.getOid(obj)
if type(oid) is str:
if isinstance(oid, (bytes, binary)):
try:
return self.oid_dict[oid]
except KeyError:
......
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