From dda229273dd372717c6b0ebb9c4042aaae4e8729 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Wed, 9 Apr 2014 15:08:25 +0200 Subject: [PATCH] [IMP] sql_db: simplify TestCursor, given that method execute() does not need overriding bzr revid: rco@openerp.com-20140409130825-rnc9hqh9t16hqcaq --- openerp/sql_db.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/openerp/sql_db.py b/openerp/sql_db.py index 126460f5317..be8c91954b9 100644 --- a/openerp/sql_db.py +++ b/openerp/sql_db.py @@ -389,7 +389,7 @@ class TestCursor(Cursor): # in order to simulate commit and rollback, the cursor maintains a # savepoint at its last commit super(TestCursor, self).__init__(*args, **kwargs) - super(TestCursor, self).execute("SAVEPOINT test_cursor") + self.execute("SAVEPOINT test_cursor") self._lock = threading.RLock() def acquire(self): @@ -398,9 +398,6 @@ class TestCursor(Cursor): def release(self): self._lock.release() - def execute(self, *args, **kwargs): - super(TestCursor, self).execute(*args, **kwargs) - def close(self, force=False): if force: super(TestCursor, self).close() @@ -412,12 +409,12 @@ class TestCursor(Cursor): _logger.debug("TestCursor.autocommit(%r) does nothing", on) def commit(self): - super(TestCursor, self).execute("RELEASE SAVEPOINT test_cursor") - super(TestCursor, self).execute("SAVEPOINT test_cursor") + self.execute("RELEASE SAVEPOINT test_cursor") + self.execute("SAVEPOINT test_cursor") def rollback(self): - super(TestCursor, self).execute("ROLLBACK TO SAVEPOINT test_cursor") - super(TestCursor, self).execute("SAVEPOINT test_cursor") + self.execute("ROLLBACK TO SAVEPOINT test_cursor") + self.execute("SAVEPOINT test_cursor") class PsycoConnection(psycopg2.extensions.connection): pass