[Zodb-checkins] CVS: Zope3/src/transaction - manager.py:1.8 interfaces.py:1.5

Jeremy Hylton jeremy@zope.com
Thu, 20 Mar 2003 12:25:55 -0500


Update of /cvs-repository/Zope3/src/transaction
In directory cvs.zope.org:/tmp/cvs-serv14445

Modified Files:
	manager.py interfaces.py 
Log Message:
Change prepare() signature in IDataManager.

The manager should raise an exception in its prepare() method rather
than returning a boolean to indicate failure.  Rationale: The txn
manager can't raise a reasonable exception, because it doesn't know
what the data manager couldn't prepare.


=== Zope3/src/transaction/manager.py 1.7 => 1.8 ===
--- Zope3/src/transaction/manager.py:1.7	Thu Mar 13 13:48:55 2003
+++ Zope3/src/transaction/manager.py	Thu Mar 20 12:25:54 2003
@@ -23,18 +23,14 @@
         # commit calls _finishCommit() or abort()
         assert txn._status is Status.ACTIVE
         txn._status = Status.PREPARING
-        prepare_ok = True
         self.logger.debug("%s: prepare", txn)
         try:
             for r in txn._resources:
-                if prepare_ok and not r.prepare(txn):
-                    raise AbortError(r)
+                r.prepare(txn)
         except:
             txn._status = Status.FAILED
             raise
         txn._status = Status.PREPARED
-        # XXX An error below is intolerable.  What state to use?
-        # Need code to handle this case.
         self._finishCommit(txn)
 
     def _finishCommit(self, txn):


=== Zope3/src/transaction/interfaces.py 1.4 => 1.5 ===
--- Zope3/src/transaction/interfaces.py:1.4	Thu Mar  6 19:15:26 2003
+++ Zope3/src/transaction/interfaces.py	Thu Mar 20 12:25:54 2003
@@ -57,7 +57,8 @@
     def prepare(transaction):
         """Begin two-phase commit of a transaction.
 
-        DataManager should return True or False.
+        The data manager must raise an exception if it is not prepared
+        to commit the transaction after executing prepare().
         """
 
     def abort(transaction):