[Zope3-checkins] CVS: Zope3/lib/python/ZODB - Connection.py:1.88 utils.py:1.16

Jeremy Hylton jeremy@zope.com
Mon, 2 Dec 2002 16:15:11 -0500


Update of /cvs-repository/Zope3/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv29379

Modified Files:
	Connection.py utils.py 
Log Message:
Fix use of Set -- want union not intersection, hence |= not +=.
Fix 2.2 Set class to return self from __ior__().


=== Zope3/lib/python/ZODB/Connection.py 1.87 => 1.88 ===
--- Zope3/lib/python/ZODB/Connection.py:1.87	Mon Dec  2 15:22:38 2002
+++ Zope3/lib/python/ZODB/Connection.py	Mon Dec  2 16:15:10 2002
@@ -320,8 +320,8 @@
         self._storage.tpc_begin(txn)
         
         # Copy invalidating and creating info from temporary storage:
-        self._modified += Set(tmp._index)
-        self._created += tmp._created
+        self._modified |= Set(tmp._index)
+        self._created |= tmp._created
         
         for oid in tmp._index:
             data, serial = tmp.load(oid, tmp._bver)
@@ -339,12 +339,8 @@
         self._cache.invalidateMany(tmp._index)
         self._invalidate_created(tmp._created)
 
-    def _invalidate_created(self, created=None):
+    def _invalidate_created(self, created):
         """Dis-own new objects from uncommitted transaction."""
-        if created is None:
-            created = self._created
-            self._created = Set()
-
         for oid in created:
             o = self._cache.get(oid)
             if o is not None:
@@ -395,7 +391,8 @@
             del self._txns[txn]
         self._cache.invalidateMany(self._invalidated)
         self._cache.invalidateMany(self._modified)
-        self._invalidate_created()
+        self._invalidate_created(self._created)
+        self._created = Set()
 
         self._invalidated.clear()
         self._modified.clear()


=== Zope3/lib/python/ZODB/utils.py 1.15 => 1.16 ===
--- Zope3/lib/python/ZODB/utils.py:1.15	Mon Dec  2 15:22:38 2002
+++ Zope3/lib/python/ZODB/utils.py	Mon Dec  2 16:15:10 2002
@@ -45,7 +45,8 @@
     class Set(dict):
         def add(self, o):
             self[o] = 1
-        def __add__(self, other):
+        def __ior__(self, other):
             if not isinstance(other, Set):
                 return NotImplemented
             self.update(other)
+            return self