当前位置: 首页>>代码示例>>Python>>正文


Python PackagesLogic.delete_package方法代码示例

本文整理汇总了Python中coprs.logic.packages_logic.PackagesLogic.delete_package方法的典型用法代码示例。如果您正苦于以下问题:Python PackagesLogic.delete_package方法的具体用法?Python PackagesLogic.delete_package怎么用?Python PackagesLogic.delete_package使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在coprs.logic.packages_logic.PackagesLogic的用法示例。


在下文中一共展示了PackagesLogic.delete_package方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: copr_delete_package

# 需要导入模块: from coprs.logic.packages_logic import PackagesLogic [as 别名]
# 或者: from coprs.logic.packages_logic.PackagesLogic import delete_package [as 别名]
def copr_delete_package(copr, package_id):
    package = ComplexLogic.get_package_by_id_safe(package_id)

    try:
        PackagesLogic.delete_package(flask.g.user, package)
    except (InsufficientRightsException, ActionInProgressException) as e:
        flask.flash(str(e), "error")
    else:
        db.session.commit()
        flask.flash("Package has been deleted successfully.", "success")

    return flask.redirect(helpers.copr_url("coprs_ns.copr_packages", copr))
开发者ID:0-T-0,项目名称:copr,代码行数:14,代码来源:coprs_packages.py

示例2: copr_delete_package

# 需要导入模块: from coprs.logic.packages_logic import PackagesLogic [as 别名]
# 或者: from coprs.logic.packages_logic.PackagesLogic import delete_package [as 别名]
def copr_delete_package(copr, package_name):
    try:
        package = PackagesLogic.get(copr.id, package_name)[0]
    except IndexError:
        raise LegacyApiError("No package with name {name} in copr {copr}".format(name=package_name, copr=copr.name))

    try:
        PackagesLogic.delete_package(flask.g.user, package)
        db.session.commit()
    except (InsufficientRightsException, ActionInProgressException) as e:
        raise LegacyApiError(str(e))

    return flask.jsonify({
        "output": "ok",
        "message": "Package was successfully deleted.",
        'package': package.to_dict(),
    })
开发者ID:RadimS97,项目名称:copr,代码行数:19,代码来源:api_general.py


注:本文中的coprs.logic.packages_logic.PackagesLogic.delete_package方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。