--- a/dbapi.py Fri Jul 02 10:29:32 2010 +0200
+++ b/dbapi.py Fri Jul 02 11:52:51 2010 +0200
@@ -440,7 +440,7 @@
DeprecationWarning, stacklevel=2)
# XXX use named argument for build_descr in case repo is < 3.8
rset = self._repo.execute(self._sessid, rql, args,
- build_descr=build_descr, txid=self._txid())
+ build_descr=build_descr, **self._txid())
rset.req = self.req
return rset
@@ -479,6 +479,10 @@
if cnxprops and cnxprops.log_queries:
self.executed_queries = []
self.cursor_class = LogCursor
+ if self._cnxtype == 'pyro':
+ # check client/server compat
+ if self._repo.get_versions()['cubicweb'] < (3, 8, 6):
+ self._txid = lambda cursor=None: {}
def __repr__(self):
if self.anonymous_connection:
@@ -496,7 +500,8 @@
return False #propagate the exception
def _txid(self, cursor=None): # XXX could now handle various isolation level!
- return currentThread().getName()
+ # return a dict as bw compat trick
+ return {'txid': currentThread().getName()}
def request(self):
return DBAPIRequest(self.vreg, DBAPISession(self))
@@ -634,7 +639,7 @@
def describe(self, eid):
if self._closed is not None:
raise ProgrammingError('Closed connection')
- return self._repo.describe(self.sessionid, eid, txid=self._txid())
+ return self._repo.describe(self.sessionid, eid, **self._txid())
def close(self):
"""Close the connection now (rather than whenever __del__ is called).
@@ -647,7 +652,7 @@
"""
if self._closed:
raise ProgrammingError('Connection is already closed')
- self._repo.close(self.sessionid, txid=self._txid())
+ self._repo.close(self.sessionid, **self._txid())
del self._repo # necessary for proper garbage collection
self._closed = 1
@@ -661,7 +666,7 @@
"""
if not self._closed is None:
raise ProgrammingError('Connection is already closed')
- return self._repo.commit(self.sessionid, txid=self._txid())
+ return self._repo.commit(self.sessionid, **self._txid())
def rollback(self):
"""This method is optional since not all databases provide transaction
@@ -674,7 +679,7 @@
"""
if not self._closed is None:
raise ProgrammingError('Connection is already closed')
- self._repo.rollback(self.sessionid, txid=self._txid())
+ self._repo.rollback(self.sessionid, **self._txid())
def cursor(self, req=None):
"""Return a new Cursor Object using the connection.
@@ -714,8 +719,8 @@
only searched in 'public' actions, unless a `public` argument is given
and set to false.
"""
+ actionfilters.update(self._txid())
txinfos = self._repo.undoable_transactions(self.sessionid, ueid,
- txid=self._txid(),
**actionfilters)
if req is None:
req = self.request()
@@ -731,7 +736,7 @@
him).
"""
txinfo = self._repo.transaction_info(self.sessionid, txuuid,
- txid=self._txid())
+ **self._txid())
if req is None:
req = self.request()
txinfo.req = req
@@ -748,7 +753,7 @@
transaction doesn't belong to him).
"""
return self._repo.transaction_actions(self.sessionid, txuuid, public,
- txid=self._txid())
+ **self._txid())
def undo_transaction(self, txuuid):
"""Undo the given transaction. Return potential restoration errors.
@@ -758,4 +763,4 @@
him).
"""
return self._repo.undo_transaction(self.sessionid, txuuid,
- txid=self._txid())
+ **self._txid())