Ejemplo n.º 1
0
    def rollback(self):
        transaction = self.transaction
        if transaction is None:
            raise interfaces.InvalidSavepointRollbackError(
                'invalidated by a later savepoint')
        transaction._remove_and_invalidate_after(self)

        try:
            for savepoint in self._savepoints:
                savepoint.rollback()
        except:
            # Mark the transaction as failed.
            transaction._saveAndRaiseCommitishError()  # reraises!
Ejemplo n.º 2
0
    def rollback(self):
        """See `~transaction.interfaces.ISavepoint`."""
        transaction = self.transaction
        if transaction is None:
            raise interfaces.InvalidSavepointRollbackError(
                'invalidated by a later savepoint')
        transaction._remove_and_invalidate_after(self)

        try:
            for savepoint in self._savepoints:
                savepoint.rollback()
        except:  # noqa: E722 do not use bare 'except'
            # Mark the transaction as failed.
            transaction._saveAndRaiseCommitishError()  # reraises!