[Zodb-checkins] CVS: Zope3/src/zodb - conflict.py:1.4
Tim Peters
tim.one@comcast.net
Fri, 10 Jan 2003 16:18:53 -0500
Update of /cvs-repository/Zope3/src/zodb
In directory cvs.zope.org:/tmp/cvs-serv6452/src/zodb
Modified Files:
conflict.py
Log Message:
Introduced new class ResolvedObjectWriter, in order to handle conflict
resolution where the resolved object contains references to persistent
objects. Before, conflict resolution was quite horribly broken, although
nothing detected that. Thought from Jeremy, typing from Tim.
=== Zope3/src/zodb/conflict.py 1.3 => 1.4 ===
--- Zope3/src/zodb/conflict.py:1.3 Thu Jan 9 13:16:16 2003
+++ Zope3/src/zodb/conflict.py Fri Jan 10 16:18:50 2003
@@ -61,6 +61,16 @@
def __init__(self, oid):
self.oid = oid
+# This class needs to deal with PersistentReference objects, instead of
+# regular persistent objects.
+class ResolvedObjectWriter(ObjectWriter):
+
+ def _persistent_id(self, obj):
+ if isinstance(obj, PersistentReference):
+ return obj.oid
+ else:
+ return None
+
class ResolveObjectReader(BaseObjectReader):
# The bad_classes attribute tracks all classes for which an
@@ -153,6 +163,6 @@
except ConflictError:
return None
- writer = ObjectWriter()
+ writer = ResolvedObjectWriter()
obj = ResolvedObjectAdapter(get_self(resolve), resolved)
return writer.getState(obj)