Example #1
0
 def get(self):
     """See `~transaction.interfaces.ITransactionManager`."""
     if self._txn is None:
         if self.explicit:
             raise NoTransaction()
         self._txn = Transaction(self._synchs, self)
     return self._txn
Example #2
0
 def begin(self):
     """ See ITransactionManager.
     """
     if self._txn is not None:
         self._txn.abort()
     txn = self._txn = Transaction(self._synchs, self)
     _new_transaction(txn, self._synchs)
     return txn
Example #3
0
 def get(self):
     """ See ITransactionManager.
     """
     if self._txn is None:
         if self.explicit:
             raise NoTransaction()
         self._txn = Transaction(self._synchs, self)
     return self._txn
Example #4
0
 def begin(self):
     """See `~transaction.interfaces.ITransactionManager`."""
     if self._txn is not None:
         if self.explicit:
             raise AlreadyInTransaction()
         self._txn.abort()
     txn = self._txn = Transaction(self._synchs, self)
     _new_transaction(txn, self._synchs)
     return txn
Example #5
0
 def get(self):
     tid = thread.get_ident()
     txn = self._txns.get(tid)
     if txn is None:
         synchs = self._synchs.get(tid)
         if synchs is None:
             synchs = self._synchs[tid] = WeakSet()
         txn = self._txns[tid] = Transaction(synchs, self)
     return txn
Example #6
0
    def get(self):
        tid = thread.get_ident()

        txn = self._txns.get(tid)
        if txn is None:
            synchs = self._synchs.get(tid)
            if synchs is None:
                from ZODB.utils import WeakSet
                synchs = self._synchs[tid] = WeakSet()
            if self._global_syncs:
                [synchs.add(gs) for gs in self._global_syncs]
            txn = self._txns[tid] = Transaction(synchs, self)
        return txn
Example #7
0
    def begin(self):
        tid = thread.get_ident()
        txn = self._txns.get(tid)
        if txn is not None:
            txn.abort()

        synchs = self._synchs.get(tid)
        if synchs is None:
            synchs = self._synchs[tid] = WeakSet()

        txn = self._txns[tid] = Transaction(synchs, self)
        _new_transaction(txn, synchs)
        return txn
Example #8
0
    def begin(self):
        tid = thread.get_ident()
        txn = self._txns.get(tid)
        if txn is not None:
            txn.abort()

        synchs = self._synchs.get(tid)
        if synchs is None:
            from ZODB.utils import WeakSet
            synchs = self._synchs[tid] = WeakSet()
        if self._global_syncs:
            [synchs.add(gs) for gs in self._global_syncs]
        txn = self._txns[tid] = Transaction(synchs, self)
        _new_transaction(txn, synchs)
        return txn
Example #9
0
 def get(self):
     """ See ITransactionManager.
     """
     if self._txn is None:
         self._txn = Transaction(self._synchs, self)
     return self._txn
Example #10
0
 def test_free_w_other_txn(self):
     from transaction._transaction import Transaction
     tm = self._makeOne()
     txn = Transaction()
     tm.begin()
     self.assertRaises(ValueError, tm.free, txn)
Example #11
0
 def get(self):
     if self._txn is None:
         self._txn = Transaction(self._synchs, self)
     return self._txn
Example #12
0
 def begin(self):
     if self._txn is not None:
         self._txn.abort()
     txn = self._txn = Transaction(self._synchs, self)
     _new_transaction(txn, self._synchs)
     return txn