本文整理匯總了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))
示例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(),
})