本文整理汇总了Python中coprs.logic.complex_logic.ComplexLogic.delete_copr方法的典型用法代码示例。如果您正苦于以下问题:Python ComplexLogic.delete_copr方法的具体用法?Python ComplexLogic.delete_copr怎么用?Python ComplexLogic.delete_copr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coprs.logic.complex_logic.ComplexLogic
的用法示例。
在下文中一共展示了ComplexLogic.delete_copr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_delete
# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import delete_copr [as 别名]
def process_delete(copr, url_on_error, url_on_success):
form = forms.CoprDeleteForm()
if form.validate_on_submit():
try:
ComplexLogic.delete_copr(copr)
except (exceptions.ActionInProgressException,
exceptions.InsufficientRightsException) as e:
db.session.rollback()
flask.flash(str(e), "error")
return flask.redirect(url_on_error)
else:
db.session.commit()
flask.flash("Project has been deleted successfully.")
return flask.redirect(url_on_success)
else:
return render_template("coprs/detail/settings/delete.html", form=form, copr=copr)
示例2: api_copr_delete
# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import delete_copr [as 别名]
def api_copr_delete(copr):
""" Deletes selected user's project
"""
form = forms.CoprDeleteForm(csrf_enabled=False)
httpcode = 200
if form.validate_on_submit() and copr:
try:
ComplexLogic.delete_copr(copr)
except (exceptions.ActionInProgressException,
exceptions.InsufficientRightsException) as err:
db.session.rollback()
raise LegacyApiError(str(err))
else:
message = "Project {} has been deleted.".format(copr.name)
output = {"output": "ok", "message": message}
db.session.commit()
else:
raise LegacyApiError("Invalid request")
return flask.jsonify(output)