Author: phd
Date: 2007-04-09 08:34:47 -0600 (Mon, 09 Apr 2007)
New Revision: 2490
Modified:
SQLObject/branches/0.8/docs/News.txt
SQLObject/branches/0.8/sqlobject/dbconnection.py
Log:
Fixed ConnectionHub.doInTransaction() - if the original connection was
processConnection - reset processConnection, not threadConnection.
Modified: SQLObject/branches/0.8/docs/News.txt
===================================================================
--- SQLObject/branches/0.8/docs/News.txt 2007-04-04 06:16:56 UTC (rev 2489)
+++ SQLObject/branches/0.8/docs/News.txt 2007-04-09 14:34:47 UTC (rev 2490)
@@ -7,6 +7,15 @@
.. _start:
+SQLObject 0.8.2
+===============
+
+Bug Fixes
+---------
+
+* Fixed ConnectionHub.doInTransaction() - if the original connection was
+ processConnection - reset processConnection, not threadConnection.
+
SQLObject 0.8.1
===============
Modified: SQLObject/branches/0.8/sqlobject/dbconnection.py
===================================================================
--- SQLObject/branches/0.8/sqlobject/dbconnection.py 2007-04-04 06:16:56 UTC (rev 2489)
+++ SQLObject/branches/0.8/sqlobject/dbconnection.py 2007-04-09 14:34:47 UTC (rev 2490)
@@ -973,9 +973,17 @@
"""
# @@: In Python 2.5, something usable with with: should also
# be added.
- old_conn = self.getConnection()
+ try:
+ old_conn = self.threadingLocal.connection
+ old_conn_is_threading = True
+ except AttributeError:
+ old_conn = self.processConnection
+ old_conn_is_threading = False
conn = old_conn.transaction()
- self.threadConnection = conn
+ if old_conn_is_threading:
+ self.threadConnection = conn
+ else:
+ self.processConnection = conn
try:
try:
value = func(*args, **kw)
@@ -986,7 +994,10 @@
conn.commit(close=True)
return value
finally:
- self.threadConnection = old_conn
+ if old_conn_is_threading:
+ self.threadConnection = old_conn
+ else:
+ self.processConnection = old_conn
def _set_threadConnection(self, value):
self.threadingLocal.connection = value
|