Commit 05ff36dd authored by Julien Muchembled's avatar Julien Muchembled

Drop some compatibility code for ZODB < 3.5

parent ba690b47
...@@ -77,7 +77,6 @@ class PickleUpdater(ObjectReader, ObjectWriter, object): ...@@ -77,7 +77,6 @@ class PickleUpdater(ObjectReader, ObjectWriter, object):
"""Function-like class to update obsolete references in pickle""" """Function-like class to update obsolete references in pickle"""
def __new__(cls, obj, recursive=False): def __new__(cls, obj, recursive=False):
assert cls.get, "Persistent migration of pickle requires ZODB >= 3.5"
self = object.__new__(cls) self = object.__new__(cls)
obj = aq_base(obj) obj = aq_base(obj)
connection = obj._p_jar connection = obj._p_jar
...@@ -88,7 +87,7 @@ class PickleUpdater(ObjectReader, ObjectWriter, object): ...@@ -88,7 +87,7 @@ class PickleUpdater(ObjectReader, ObjectWriter, object):
oid_set = set((obj._p_oid,)) oid_set = set((obj._p_oid,))
while oid_set: while oid_set:
oid = oid_set.pop() oid = oid_set.pop()
obj = self.get(oid) obj = ObjectReader.load_oid(self, oid)
obj._p_activate() obj._p_activate()
klass = obj.__class__ klass = obj.__class__
self.lazy = None self.lazy = None
...@@ -123,8 +122,6 @@ class PickleUpdater(ObjectReader, ObjectWriter, object): ...@@ -123,8 +122,6 @@ class PickleUpdater(ObjectReader, ObjectWriter, object):
self.setGhostState(obj, self.serialize(obj)) self.setGhostState(obj, self.serialize(obj))
obj._p_changed = 1 obj._p_changed = 1
get = getattr(ObjectReader, 'load_oid', None)
def getOid(self, obj): def getOid(self, obj):
if isinstance(obj, (Persistent, type, wref.WeakRef)): if isinstance(obj, (Persistent, type, wref.WeakRef)):
return getattr(obj, '_p_oid', None) return getattr(obj, '_p_oid', None)
...@@ -134,7 +131,7 @@ class PickleUpdater(ObjectReader, ObjectWriter, object): ...@@ -134,7 +131,7 @@ class PickleUpdater(ObjectReader, ObjectWriter, object):
if self.lazy: if self.lazy:
return self.lazy(oid) return self.lazy(oid)
self.oid_set.add(oid) self.oid_set.add(oid)
return self.get(oid) return ObjectReader.load_oid(self, oid)
def load_persistent(self, oid, klass): def load_persistent(self, oid, klass):
obj = ObjectReader.load_persistent(self, oid, klass) obj = ObjectReader.load_persistent(self, oid, klass)
......
...@@ -364,8 +364,6 @@ def synchronizeDynamicModules(context, force=False): ...@@ -364,8 +364,6 @@ def synchronizeDynamicModules(context, force=False):
tool.__class__ = getattr(erp5.portal_type, tool.portal_type) tool.__class__ = getattr(erp5.portal_type, tool.portal_type)
if migrate: if migrate:
from Products.ERP5Type.dynamic.persistent_migration import PickleUpdater
if PickleUpdater.get:
portal.migrateToPortalTypeClass() portal.migrateToPortalTypeClass()
portal.portal_skins.changeSkin(None) portal.portal_skins.changeSkin(None)
TransactionalResource(tpc_finish=lambda txn: TransactionalResource(tpc_finish=lambda txn:
......
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