[Checkins] SVN: z3c.sqlalchemy/trunk/ better error handling in case
of a DB rollback
Andreas Jung
andreas at andreas-jung.com
Thu May 8 01:32:19 EDT 2008
Log message for revision 86539:
better error handling in case of a DB rollback
Changed:
U z3c.sqlalchemy/trunk/CHANGES.txt
U z3c.sqlalchemy/trunk/setup.py
U z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/base.py
-=-
Modified: z3c.sqlalchemy/trunk/CHANGES.txt
===================================================================
--- z3c.sqlalchemy/trunk/CHANGES.txt 2008-05-07 21:25:22 UTC (rev 86538)
+++ z3c.sqlalchemy/trunk/CHANGES.txt 2008-05-08 05:32:17 UTC (rev 86539)
@@ -1,3 +1,8 @@
+1.1.5 (08.05.2008)
+------------------
+
+ - better error handling in case of a rollback (patch by Dieter Maurer)
+
1.1.4 (15.03.2008)
------------------
Modified: z3c.sqlalchemy/trunk/setup.py
===================================================================
--- z3c.sqlalchemy/trunk/setup.py 2008-05-07 21:25:22 UTC (rev 86538)
+++ z3c.sqlalchemy/trunk/setup.py 2008-05-08 05:32:17 UTC (rev 86539)
@@ -23,7 +23,7 @@
'Topic :: Software Development :: Libraries :: Python Modules',
]
-version = '1.1.14'
+version = '1.1.15'
desc = open('README.txt').read().strip()
changes = open('CHANGES.txt').read().strip()
Modified: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/base.py
===================================================================
--- z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/base.py 2008-05-07 21:25:22 UTC (rev 86538)
+++ z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/base.py 2008-05-08 05:32:17 UTC (rev 86539)
@@ -171,11 +171,15 @@
def abort(self, trans):
- if self.transaction is not None:
- self.transaction.rollback()
- self.session.clear()
- connection_cache.remove(self._id)
- self._cleanup()
+ try:
+ if self.transaction is not None:
+ self.transaction.rollback()
+ # DM: done in "_cleanup" (similar untidy code at other places as well)
+## self.session.clear()
+## connection_cache.remove(self._id)
+ finally:
+ # ensure '_cleanup' is called even when 'rollback' causes an exception
+ self._cleanup()
def _flush(self):
@@ -208,10 +212,12 @@
self._cleanup()
- def tpc_abort(self, trans):
- if self.transaction is not None:
- self.transaction.rollback()
- self._cleanup()
+ # DM: no need to duplicate this code (identical to "abort")
+## def tpc_abort(self, trans):
+## if self.transaction is not None:
+## self.transaction.rollback()
+## self._cleanup()
+ tpc_abort = abort
def sortKey(self):
return 'z3c.sqlalchemy_' + str(id(self))
@@ -222,6 +228,7 @@
self.connection.close()
self.connection = None
connection_cache.remove(self._id)
+ # DM: maybe, we should set "transaction" to "None"?
def savepoint(self):
""" return a dummy savepoint """
More information about the Checkins
mailing list