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

Jim Fulton jim at zope.com
Wed Sep 17 08:47:42 EDT 2003


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

Modified Files:
      Tag: parentgeddon-branch
	connection.py 
Log Message:
Changed the data structure for registered objects to be a dictionary
mapping oid to object rather than a set of objects. This is needed to
support persistent proxies.


=== Zope3/src/zodb/connection.py 1.35 => 1.35.20.1 ===
--- Zope3/src/zodb/connection.py:1.35	Thu Jun 19 17:41:10 2003
+++ Zope3/src/zodb/connection.py	Wed Sep 17 08:47:41 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 Zodb-checkins mailing list