Fixed rollback on error on Zope (ticket #73)

This commit is contained in:
Federico Di Gregorio 2011-12-16 10:37:01 +01:00
parent b5de04d2ff
commit 71a4c2bac9
2 changed files with 9 additions and 5 deletions

1
NEWS
View File

@ -2,6 +2,7 @@ What's new in psycopg 2.4.4
---------------------------
- Named DictCursor/RealDictCursor honour itersize (ticket #80).
- Fixed rollback on error on Zope (ticket #73).
What's new in psycopg 2.4.3

View File

@ -47,12 +47,15 @@ class DB(TM, dbi_db.DB):
self.calls = 0
self.make_mappings()
def getconn(self, create=True):
def getconn(self, init=True):
# if init is False we are trying to get hold on an already existing
# connection, so we avoid to (re)initialize it risking errors.
conn = pool.getconn(self.dsn)
conn.set_isolation_level(int(self.tilevel))
conn.set_client_encoding(self.encoding)
for tc in self.typecasts:
register_type(tc, conn)
if init:
conn.set_isolation_level(int(self.tilevel))
conn.set_client_encoding(self.encoding)
for tc in self.typecasts:
register_type(tc, conn)
return conn
def putconn(self, close=False):