[SQL-CVS] r1839 - SQLObject/branches/0.7-bugfix/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2006-08-02 14:31:47
|
Author: phd
Date: 2006-08-02 08:31:45 -0600 (Wed, 02 Aug 2006)
New Revision: 1839
Modified:
SQLObject/branches/0.7-bugfix/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/branches/0.7-bugfix/sqlobject/dbconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py 2006-08-02 14:31:28 UTC (rev 1838)
+++ SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py 2006-08-02 14:31:45 UTC (rev 1839)
@@ -733,12 +733,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"
|