Commit 01b6183a authored by Łukasz Nowak's avatar Łukasz Nowak

- use transaction.commit instead of obsoleted get_transaction().commit


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29148 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0174ea01
...@@ -32,6 +32,7 @@ from _mysql_exceptions import OperationalError ...@@ -32,6 +32,7 @@ from _mysql_exceptions import OperationalError
from Products.ZMySQLDA.db import hosed_connection from Products.ZMySQLDA.db import hosed_connection
from thread import get_ident from thread import get_ident
from zLOG import LOG from zLOG import LOG
import transaction
UNCONNECTED_STATE = 0 UNCONNECTED_STATE = 0
CONNECTED_STATE = 1 CONNECTED_STATE = 1
...@@ -124,7 +125,7 @@ class TestDeferredConnection(ERP5TypeTestCase): ...@@ -124,7 +125,7 @@ class TestDeferredConnection(ERP5TypeTestCase):
connection = self.getDeferredConnection() connection = self.getDeferredConnection()
connection.query('REPLACE INTO `full_text` SET `uid`=0, `SearchableText`="dummy test"') connection.query('REPLACE INTO `full_text` SET `uid`=0, `SearchableText`="dummy test"')
try: try:
get_transaction().commit() transaction.commit()
except OperationalError: except OperationalError:
self.fail() self.fail()
except: except:
...@@ -146,7 +147,7 @@ class TestDeferredConnection(ERP5TypeTestCase): ...@@ -146,7 +147,7 @@ class TestDeferredConnection(ERP5TypeTestCase):
connection._query = connection.db.query connection._query = connection.db.query
try: try:
try: try:
get_transaction().commit() transaction.commit()
except OperationalError, m: except OperationalError, m:
if m[0] not in hosed_connection: if m[0] not in hosed_connection:
raise raise
...@@ -171,7 +172,7 @@ class TestDeferredConnection(ERP5TypeTestCase): ...@@ -171,7 +172,7 @@ class TestDeferredConnection(ERP5TypeTestCase):
self.monkeypatchConnection(connection) self.monkeypatchConnection(connection)
try: try:
try: try:
get_transaction().commit() transaction.commit()
except OperationalError, m: except OperationalError, m:
LOG('TestDeferredConnection', 0, 'OperationalError exception raised: %s' % (m, )) LOG('TestDeferredConnection', 0, 'OperationalError exception raised: %s' % (m, ))
self.fail() self.fail()
...@@ -190,7 +191,7 @@ class TestDeferredConnection(ERP5TypeTestCase): ...@@ -190,7 +191,7 @@ class TestDeferredConnection(ERP5TypeTestCase):
# Queue a query # Queue a query
connection.query('REPLACE INTO `full_text` SET `uid`=0, `SearchableText`="dummy test"') connection.query('REPLACE INTO `full_text` SET `uid`=0, `SearchableText`="dummy test"')
self.assertEqual(len(connection._sql_string_list), 1) self.assertEqual(len(connection._sql_string_list), 1)
get_transaction().commit() transaction.commit()
connection.query('REPLACE INTO `full_text` SET `uid`=0, `SearchableText`="dummy test"') connection.query('REPLACE INTO `full_text` SET `uid`=0, `SearchableText`="dummy test"')
self.assertEqual(len(connection._sql_string_list), 1) self.assertEqual(len(connection._sql_string_list), 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment