Commit 7cb5d8ca authored by Tim Peters's avatar Tim Peters

Added XXX comments about stray output produced by

testExceptionInTpcAbort().  The cause is clear now, but a solution isn't;
an exception in tpc_abort is nasty.
parent f813e2d6
...@@ -36,7 +36,7 @@ TODO ...@@ -36,7 +36,7 @@ TODO
add in tests for objects which are modified multiple times, add in tests for objects which are modified multiple times,
for example an object that gets modified in multiple sub txns. for example an object that gets modified in multiple sub txns.
$Id: testTransaction.py,v 1.21 2004/04/02 19:31:32 tim_one Exp $ $Id: testTransaction.py,v 1.22 2004/04/02 19:48:22 tim_one Exp $
""" """
import unittest import unittest
...@@ -385,6 +385,9 @@ class TransactionTests(unittest.TestCase): ...@@ -385,6 +385,9 @@ class TransactionTests(unittest.TestCase):
self.sub1.modify(nojar=1) self.sub1.modify(nojar=1)
try: try:
# XXX Transaction._cleanup() prints a stray "error tpc_abort"
# XXX (the string value of the TestTxnException instance raised)
# XXX to stdout.
get_transaction().commit() get_transaction().commit()
except TestTxnException: except TestTxnException:
pass pass
......
...@@ -324,11 +324,13 @@ class Transaction(object): ...@@ -324,11 +324,13 @@ class Transaction(object):
try: try:
rm.abort_sub(self) rm.abort_sub(self)
except Exception, err: except Exception, err:
# XXX Just printing the error doesn't seem good enough.
print err print err
else: else:
try: try:
rm.tpc_abort(self) rm.tpc_abort(self)
except Exception, err: except Exception, err:
# XXX Just printing the error doesn't seem good enough.
print err print err
def _getResourceManagers(self, subtransaction): def _getResourceManagers(self, subtransaction):
...@@ -498,7 +500,7 @@ class MultiObjectResourceAdapterSub(MultiObjectResourceAdapter): ...@@ -498,7 +500,7 @@ class MultiObjectResourceAdapterSub(MultiObjectResourceAdapter):
self.manager.tpc_finish(txn) self.manager.tpc_finish(txn)
if self.sub: if self.sub:
self.objects = [] self.objects = []
def rm_cmp(rm1, rm2): def rm_cmp(rm1, rm2):
return cmp(rm1.sortKey(), rm2.sortKey()) return cmp(rm1.sortKey(), rm2.sortKey())
...@@ -534,7 +536,7 @@ class DataManagerAdapter(object): ...@@ -534,7 +536,7 @@ class DataManagerAdapter(object):
def __init__(self, datamanager): def __init__(self, datamanager):
self._datamanager = datamanager self._datamanager = datamanager
self._rollback = None self._rollback = None
# XXX I'm not sure why commit() doesn't do anything # XXX I'm not sure why commit() doesn't do anything
def commit(self, transaction): def commit(self, transaction):
...@@ -558,7 +560,7 @@ class DataManagerAdapter(object): ...@@ -558,7 +560,7 @@ class DataManagerAdapter(object):
# Nothing to do wrt data, be we begin 2pc for the top-level # Nothing to do wrt data, be we begin 2pc for the top-level
# trans # trans
self._sub = False self._sub = False
def tpc_begin(self, transaction, subtransaction=False): def tpc_begin(self, transaction, subtransaction=False):
self._sub = subtransaction self._sub = subtransaction
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment