From: Mike Bayer Date: Wed, 7 Nov 2007 21:46:48 +0000 (+0000) Subject: fixed the previous TLTransaction checkin X-Git-Tag: rel_0_4_1~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f9c8d1cf34f93b895a9f3e6fd91d1718e0186951;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git fixed the previous TLTransaction checkin --- diff --git a/CHANGES b/CHANGES index 9f329b1e58..51f659f61b 100644 --- a/CHANGES +++ b/CHANGES @@ -41,7 +41,7 @@ CHANGES [ticket:573] - fixed the close() method on Transaction when using strategy='threadlocal' - + - orm - eager loading with LIMIT/OFFSET applied no longer adds the primary table joined to a limited subquery of itself; the eager loads now diff --git a/lib/sqlalchemy/engine/threadlocal.py b/lib/sqlalchemy/engine/threadlocal.py index 8eb0392082..f2b950f2ec 100644 --- a/lib/sqlalchemy/engine/threadlocal.py +++ b/lib/sqlalchemy/engine/threadlocal.py @@ -80,6 +80,8 @@ class TLSession(object): def close(self): if self.__tcount == 1: self.rollback() + elif self.__tcount > 1: + self.__tcount -= 1 def is_begun(self): return self.__tcount > 0 diff --git a/test/engine/transaction.py b/test/engine/transaction.py index ca10965a5e..b6a47e3860 100644 --- a/test/engine/transaction.py +++ b/test/engine/transaction.py @@ -407,12 +407,8 @@ class TLTransactionTest(PersistTest): tlengine.execute(users.insert(), user_id=4, user_name='user4') t2.close() - external_connection = tlengine.connect() - result = external_connection.execute("select * from query_users") - try: - assert len(result.fetchall()) == 4 - finally: - external_connection.close() + result = c.execute("select * from query_users") + assert len(result.fetchall()) == 4 t.close()