Пример #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
Пример #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
Пример #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
Пример #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
Пример #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
Пример #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
Пример #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
Пример #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
Пример #9
0
 def get(self):
     """ See ITransactionManager.
     """
     if self._txn is None:
         self._txn = Transaction(self._synchs, self)
     return self._txn
Пример #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)
Пример #11
0
 def get(self):
     if self._txn is None:
         self._txn = Transaction(self._synchs, self)
     return self._txn
Пример #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