333 :attr:`read_security` and :attr:`write_security`, boolean flags telling if |
333 :attr:`read_security` and :attr:`write_security`, boolean flags telling if |
334 read/write security is currently activated. |
334 read/write security is currently activated. |
335 |
335 |
336 """ |
336 """ |
337 |
337 |
338 def __init__(self, txid, cnxset_tracker, mode, rewriter): |
338 def __init__(self, txid, session, rewriter): |
339 #: transaction unique id |
339 #: transaction unique id |
340 self.transactionid = txid |
340 self.transactionid = txid |
341 #: reentrance handling |
341 #: reentrance handling |
342 self.ctx_count = 0 |
342 self.ctx_count = 0 |
343 |
343 |
344 #: connection handling mode |
344 #: connection handling mode |
345 self.mode = mode |
345 self.mode = session.default_mode |
346 #: connection set used to execute queries on sources |
346 #: connection set used to execute queries on sources |
347 self._cnxset = None |
347 self._cnxset = None |
348 #: CnxSetTracker used to report cnxset usage |
348 #: CnxSetTracker used to report cnxset usage |
349 self._cnxset_tracker = cnxset_tracker |
349 self._cnxset_tracker = session._cnxset_tracker |
350 #: is this transaction from a client or internal to the repo |
350 #: is this transaction from a client or internal to the repo |
351 self.running_dbapi_query = True |
351 self.running_dbapi_query = True |
352 |
352 |
353 #: dict containing arbitrary data cleared at the end of the transaction |
353 #: dict containing arbitrary data cleared at the end of the transaction |
354 self.data = {} |
354 self.data = {} |
724 with self._lock: # no transaction exist with the same id |
724 with self._lock: # no transaction exist with the same id |
725 try: |
725 try: |
726 tx = self._txs[txid] |
726 tx = self._txs[txid] |
727 except KeyError: |
727 except KeyError: |
728 rewriter = RQLRewriter(self) |
728 rewriter = RQLRewriter(self) |
729 tx = Transaction(txid, self._cnxset_tracker, self.default_mode, |
729 tx = Transaction(txid, self, rewriter) |
730 rewriter) |
|
731 self._txs[txid] = tx |
730 self._txs[txid] = tx |
732 return tx |
731 return tx |
733 |
732 |
734 def set_tx(self, txid=None): |
733 def set_tx(self, txid=None): |
735 """set the default transaction of the current thread to <txid> |
734 """set the default transaction of the current thread to <txid> |