Author: ianb
Date: 2006-01-25 22:43:17 -0700 (Wed, 25 Jan 2006)
New Revision: 1537
Modified:
SQLObject/trunk/sqlobject/dbconnection.py
SQLObject/trunk/sqlobject/wsgi_middleware.py
Log:
Added a close option to .commit(), so you can close the transaction as you commit it
Modified: SQLObject/trunk/sqlobject/dbconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py 2006-01-25 01:26:45 UTC (rev 1536)
+++ SQLObject/trunk/sqlobject/dbconnection.py 2006-01-26 05:43:17 UTC (rev 1537)
@@ -814,13 +814,15 @@
return iter(list(select.IterationClass(self, self._connection,
select, keepConnection=True)))
- def commit(self):
+ def commit(self, close=False):
if self._obsolete:
# @@: is it okay to get extraneous commits?
return
if self._dbConnection.debug:
self._dbConnection.printDebug(self._connection, '', 'COMMIT')
self._connection.commit()
+ if close:
+ self._makeObsolete()
def rollback(self):
if self._obsolete:
Modified: SQLObject/trunk/sqlobject/wsgi_middleware.py
===================================================================
--- SQLObject/trunk/sqlobject/wsgi_middleware.py 2006-01-25 01:26:45 UTC (rev 1536)
+++ SQLObject/trunk/sqlobject/wsgi_middleware.py 2006-01-26 05:43:17 UTC (rev 1537)
@@ -82,7 +82,7 @@
if any_errors:
conn[0].rollback()
else:
- conn[0].commit()
+ conn[0].commit(close=True)
self.hub.threadConnection = None
def in_transaction():
return use_transaction[0]
|