[SQL-CVS] r1838 - SQLObject/trunk/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2006-08-02 14:31:33
|
Author: phd
Date: 2006-08-02 08:31:28 -0600 (Wed, 02 Aug 2006)
New Revision: 1838
Modified:
SQLObject/trunk/sqlobject/dbconnection.py
Log:
A patch by Dan Pascu <da...@ag...> to fix problems
with transaction.__del__() if there was an exception in __init__().
Modified: SQLObject/trunk/sqlobject/dbconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py 2006-08-01 18:31:26 UTC (rev 1837)
+++ SQLObject/trunk/sqlobject/dbconnection.py 2006-08-02 14:31:28 UTC (rev 1838)
@@ -785,12 +785,14 @@
class Transaction(object):
def __init__(self, dbConnection):
- self._obsolete = False
+ # this is to skip __del__ in case of an exception in this __init__
+ self._obsolete = True
self._dbConnection = dbConnection
self._connection = dbConnection.getConnection()
self._dbConnection._setAutoCommit(self._connection, 0)
self.cache = CacheSet(cache=dbConnection.doCache)
self._deletedCache = {}
+ self._obsolete = False
def assertActive(self):
assert not self._obsolete, "This transaction has already gone through ROLLBACK; begin another transaction"
|