python类leave_transaction_management()的实例源码

compat.py 文件源码 项目:sdining 作者: Lurance 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def set_rollback():
    if hasattr(transaction, 'set_rollback'):
        if connection.settings_dict.get('ATOMIC_REQUESTS', False):
            # If running in >=1.6 then mark a rollback as required,
            # and allow it to be handled by Django.
            if connection.in_atomic_block:
                transaction.set_rollback(True)
    elif transaction.is_managed():
        # Otherwise handle it explicitly if in managed mode.
        if transaction.is_dirty():
            transaction.rollback()
        transaction.leave_transaction_management()
    else:
        # transaction not managed
        pass
compat.py 文件源码 项目:graphene-jwt-auth 作者: darwin4031 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def set_rollback():
    if hasattr(transaction, 'set_rollback'):
        if connection.settings_dict.get('ATOMIC_REQUESTS', False):
            # If running in >=1.6 then mark a rollback as required,
            # and allow it to be handled by Django.
            if connection.in_atomic_block:
                transaction.set_rollback(True)
    elif transaction.is_managed():
        # Otherwise handle it explicitly if in managed mode.
        if transaction.is_dirty():
            transaction.rollback()
        transaction.leave_transaction_management()
    else:
        # transaction not managed
        pass
middleware.py 文件源码 项目:intel-manager-for-lustre 作者: intel-hpdd 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def process_response(selfself, request, response):
        if transaction.is_managed():
            if transaction.is_dirty():
                successful = not isinstance(response, http.HttpApplicationError)
                if successful:
                    transaction.commit()
                else:
                    transaction.rollback()

            transaction.leave_transaction_management()

        return response
compat.py 文件源码 项目:jianshu-api 作者: strugglingyouth 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def set_rollback():
    if hasattr(transaction, 'set_rollback'):
        if connection.settings_dict.get('ATOMIC_REQUESTS', False):
            # If running in >=1.6 then mark a rollback as required,
            # and allow it to be handled by Django.
            if connection.in_atomic_block:
                transaction.set_rollback(True)
    elif transaction.is_managed():
        # Otherwise handle it explicitly if in managed mode.
        if transaction.is_dirty():
            transaction.rollback()
        transaction.leave_transaction_management()
    else:
        # transaction not managed
        pass
compat.py 文件源码 项目:esdc-ce 作者: erigones 项目源码 文件源码 阅读 47 收藏 0 点赞 0 评论 0
def set_rollback():
    if hasattr(transaction, 'set_rollback'):
        if connection.settings_dict.get('ATOMIC_REQUESTS', False):
            # If running in >=1.6 then mark a rollback as required,
            # and allow it to be handled by Django.
            if connection.in_atomic_block:
                transaction.set_rollback(True)
    elif transaction.is_managed():
        # Otherwise handle it explicitly if in managed mode.
        if transaction.is_dirty():
            transaction.rollback()
        transaction.leave_transaction_management()
    else:
        # transaction not managed
        pass


问题


面经


文章

微信
公众号

扫码关注公众号