Author: phd
Date: 2006-04-06 08:50:57 -0600 (Thu, 06 Apr 2006)
New Revision: 1683
Modified:
SQLObject/trunk/sqlobject/dbconnection.py
SQLObject/trunk/sqlobject/tests/test_transactions.py
Log:
Applied the patch N 1464379 for .destroySelf() inside a transaction.
Modified: SQLObject/trunk/sqlobject/dbconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py 2006-04-05 14:32:39 UTC (rev 1682)
+++ SQLObject/trunk/sqlobject/dbconnection.py 2006-04-06 14:50:57 UTC (rev 1683)
@@ -826,7 +826,8 @@
if not self._deletedCache.has_key(cls):
self._deletedCache[cls] = []
self._deletedCache[cls].append(inst.id)
- return self._dbConnection._SO_delete(inst)
+ meth = new.instancemethod(self._dbConnection._SO_delete.im_func, self, self.__class__)
+ return meth(inst)
def commit(self, close=False):
if self._obsolete:
Modified: SQLObject/trunk/sqlobject/tests/test_transactions.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_transactions.py 2006-04-05 14:32:39 UTC (rev 1682)
+++ SQLObject/trunk/sqlobject/tests/test_transactions.py 2006-04-06 14:50:57 UTC (rev 1683)
@@ -51,3 +51,17 @@
assert bOut.name == 'robert'
finally:
TestSOTrans._connection.autoCommit = True
+
+def test_transaction_delete():
+ if not supports('transactions'):
+ return
+ setupClass(TestSOTrans)
+ trans = TestSOTrans._connection.transaction()
+ try:
+ TestSOTrans(name='bob')
+ bIn = TestSOTrans.byName('bob', connection=trans)
+ bIn.destroySelf()
+ bOut = TestSOTrans.select(TestSOTrans.q.name=='bob')
+ assert bOut.count() == 1
+ finally:
+ TestSOTrans._connection.autoCommit = True
|