當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。