本文整理汇总了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(),
})