[Zodb-checkins] CVS: ZODB4/ZODB - Serialize.py:1.2
Jeremy Hylton
jeremy@zope.com
Thu, 19 Sep 2002 15:12:04 -0400
Update of /cvs-repository/ZODB4/ZODB
In directory cvs.zope.org:/tmp/cvs-serv28054/ZODB
Modified Files:
Serialize.py
Log Message:
Add getObject() method to get the whole object (useful for testing).
Change getResolveMethod() to getResolver().
=== ZODB4/ZODB/Serialize.py 1.1 => 1.2 ===
--- ZODB4/ZODB/Serialize.py:1.1 Thu Sep 19 14:19:07 2002
+++ ZODB4/ZODB/Serialize.py Thu Sep 19 15:12:04 2002
@@ -44,8 +44,11 @@
return module, classname, newargs
class Pickler:
+
pass
+
+
class BaseUnpickler:
# subclasses must define _persistent_load().
@@ -80,6 +83,14 @@
state = self.getState(pickle)
object.__setstate__(state)
+ def getObject(self, pickle):
+ unpickler = self._get_unpickler(pickle)
+ module, classname, newargs = unpickler.load()
+ object = self._new_object(module, classname, newargs)
+ state = unpickler.load()
+ object.__setstate__(state)
+ return object
+
class ConnectionUnpickler(BaseUnpickler):
def __init__(self, conn, cache):
@@ -128,14 +139,14 @@
else:
return self._new_object(*classmeta)
- def getResolveMethod(self, pickle):
+ def getResolver(self, pickle):
ghost = self.getGhost(pickle)
if ghost is None:
return None
resolve = getattr(ghost, "_p_resolveConflict", None)
if resolve is None:
# XXX too bad. we just had classmeta.
- classmeta = getClassMeta(ghost)
+ classmeta = getClassMetadata(ghost)
self.bad_classes[classmeta] = True
return None
else: