[Zope3-checkins] CVS: Zope3/src/zodb - connection.py:1.36

Jim Fulton jim at zope.com
Sun Sep 21 13:29:58 EDT 2003


Update of /cvs-repository/Zope3/src/zodb
In directory cvs.zope.org:/tmp/cvs-serv11534/src/zodb

Modified Files:
	connection.py 
Log Message:
Changed the changed-object registry to use an oid->object dict rather
than an object set. This is necessary to support persistent proxied to
persistent object, which have the same hash and are equal to the
objects they proxy.


=== Zope3/src/zodb/connection.py 1.35 => 1.36 ===
--- Zope3/src/zodb/connection.py:1.35	Thu Jun 19 17:41:10 2003
+++ Zope3/src/zodb/connection.py	Sun Sep 21 13:29:58 2003
@@ -107,7 +107,7 @@
         # These sets are clear()ed at transaction boundaries.
 
         # XXX Is a Set safe?  What if the objects are not hashable?
-        self._registered = Set()
+        self._registered = {}
         self._modified = Set() # XXX is this the same as registered?
         self._created = Set()
         # _conflicts: set of objects that failed to load because
@@ -244,7 +244,7 @@
         self._log.debug("register oid=%s" % _fmt_oid(obj._p_oid))
         if not self._registered:
             self._get_transaction().join(self)
-        self._registered.add(obj)
+        self._registered[obj._p_oid] = obj
 
     def mtime(self, obj):
         # required by the IPersistentDataManager interface, but unimplemented
@@ -313,7 +313,7 @@
         else:
             self._storage.tpcBegin(txn)
 
-        for obj in self._registered:
+        for obj in self._registered.itervalues():
             self._objcommit(obj, txn)
 
         s = self._storage.tpcVote(txn)
@@ -326,8 +326,7 @@
         self._storage.tpcAbort(txn)
 
         if self._registered:
-            self._cache.invalidate([obj._p_oid
-                                        for obj in self._registered])
+            self._cache.invalidate(list(self._registered))
             self._registered.clear()
         self._invalidate_created(self._created)
         self._cache.invalidate(self._modified)
@@ -364,7 +363,7 @@
         self._created = Set()
         self._storage.tpcBegin(txn)
 
-        for obj in self._registered:
+        for obj in self._registered.itervalues():
             self._objcommit(obj, txn)
         self.importHook(txn) # hook for ExportImport
 




More information about the Zope3-Checkins mailing list