[Zope3-checkins] CVS: ZODB/src/transaction - _manager.py:1.3 _transaction.py:1.5

Jeremy Hylton jeremy at zope.com
Wed Apr 14 16:45:41 EDT 2004


Update of /cvs-repository/ZODB/src/transaction
In directory cvs.zope.org:/tmp/cvs-serv9434/src/transaction

Modified Files:
	_manager.py _transaction.py 
Log Message:
Add automatic synchronization for Connection objects.

This changes the behavior slightly for invalidations.  A Connection
will receive invalidations even if it didn't have any modified objects
in the transaction, e.g. db.undo() or a read-only transaction.  For
this to work, it assumes that the thread that called db.open() is the
thread that is going to use the connection.  If this isn't true, the
synch argument to db.open() can be used to disable the new feature.


=== ZODB/src/transaction/_manager.py 1.2 => 1.3 ===
--- ZODB/src/transaction/_manager.py:1.2	Wed Mar 31 22:56:56 2004
+++ ZODB/src/transaction/_manager.py	Wed Apr 14 16:45:38 2004
@@ -43,7 +43,7 @@
         self._txn = None
 
     def registerSynch(self, synch):
-        self.synchs.append(synch)
+        self._synchs.append(synch)
 
     def unregisterSynch(self, synch):
         self._synchs.remove(synch)


=== ZODB/src/transaction/_transaction.py 1.4 => 1.5 ===
--- ZODB/src/transaction/_transaction.py:1.4	Mon Apr  5 21:06:41 2004
+++ ZODB/src/transaction/_transaction.py	Wed Apr 14 16:45:38 2004
@@ -246,7 +246,7 @@
 
         if not subtransaction:
             for s in self._synchronizers:
-                s.beforeCompletion()
+                s.beforeCompletion(self)
 
         if not subtransaction:
             self.status = Status.COMMITTING
@@ -260,7 +260,7 @@
             if self._manager:
                 self._manager.free(self)
             for s in self._synchronizers:
-                s.afterCompletion()
+                s.afterCompletion(self)
             self.log.debug("commit")
 
     def _commitResources(self, subtransaction):
@@ -313,6 +313,8 @@
                     self.status = Status.FAILED
                     if self._manager:
                         self._manager.free(self)
+                    for s in self._synchronizers:
+                        s.afterCompletion(self)
             raise t, v, tb
 
     def _cleanup(self, L):




More information about the Zope3-Checkins mailing list