本文整理汇总了Python中coprs.logic.complex_logic.ComplexLogic.get_package_by_id_safe方法的典型用法代码示例。如果您正苦于以下问题:Python ComplexLogic.get_package_by_id_safe方法的具体用法?Python ComplexLogic.get_package_by_id_safe怎么用?Python ComplexLogic.get_package_by_id_safe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coprs.logic.complex_logic.ComplexLogic
的用法示例。
在下文中一共展示了ComplexLogic.get_package_by_id_safe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: copr_delete_package
# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_package_by_id_safe [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))