本文整理汇总了Python中coprs.logic.complex_logic.ComplexLogic.get_copr_chroot_safe方法的典型用法代码示例。如果您正苦于以下问题:Python ComplexLogic.get_copr_chroot_safe方法的具体用法?Python ComplexLogic.get_copr_chroot_safe怎么用?Python ComplexLogic.get_copr_chroot_safe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coprs.logic.complex_logic.ComplexLogic
的用法示例。
在下文中一共展示了ComplexLogic.get_copr_chroot_safe方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: copr_modify_chroot
# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_copr_chroot_safe [as 别名]
def copr_modify_chroot(copr, chrootname):
form = forms.ModifyChrootForm(csrf_enabled=False)
# chroot = coprs_logic.MockChrootsLogic.get_from_name(chrootname, active_only=True).first()
chroot = ComplexLogic.get_copr_chroot_safe(copr, chrootname)
if not form.validate_on_submit():
raise LegacyApiError("Invalid request: bad request parameters")
else:
coprs_logic.CoprChrootsLogic.update_chroot(flask.g.user, chroot, form.buildroot_pkgs.data)
db.session.commit()
output = {'output': 'ok', 'buildroot_pkgs': chroot.buildroot_pkgs}
return flask.jsonify(output)
示例2: render_chroot_edit
# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_copr_chroot_safe [as 别名]
def render_chroot_edit(copr, chroot_name):
chroot = ComplexLogic.get_copr_chroot_safe(copr, chroot_name)
# todo: get COPR_chroot, not mock chroot, WTF?!
# form = forms.ChrootForm(buildroot_pkgs=copr.buildroot_pkgs(chroot))
form = forms.ChrootForm(buildroot_pkgs=chroot.buildroot_pkgs)
# FIXME - test if chroot belongs to copr
if flask.g.user.can_build_in(copr):
return render_template("coprs/detail/edit_chroot.html",
form=form, copr=copr, chroot=chroot)
else:
raise AccessRestricted(
"You are not allowed to modify chroots in project {0}."
.format(copr.name))
示例3: process_chroot_update
# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_copr_chroot_safe [as 别名]
def process_chroot_update(copr, chroot_name):
form = forms.ChrootForm()
chroot = ComplexLogic.get_copr_chroot_safe(copr, chroot_name)
if not flask.g.user.can_build_in(copr):
raise AccessRestricted(
"You are not allowed to modify chroots in project {0}."
.format(copr.name))
if form.validate_on_submit():
if "submit" in flask.request.form:
action = flask.request.form["submit"]
if action == "update":
comps_name = comps_xml = None
if form.comps.has_file():
comps_xml = form.comps.data.stream.read()
comps_name = form.comps.data.filename
coprs_logic.CoprChrootsLogic.update_chroot(
flask.g.user, chroot, form.buildroot_pkgs.data,
comps=comps_xml, comps_name=comps_name)
elif action == "delete_comps":
CoprChrootsLogic.remove_comps(flask.g.user, chroot)
flask.flash(
"Buildroot {0} in project {1} has been updated successfully.".format(
chroot_name, copr.name))
db.session.commit()
return flask.redirect(url_for_copr_edit(copr))
else:
flask.flash("You are not allowed to modify chroots.")
return render_chroot_edit(copr, chroot_name)
示例4: render_chroot_view_comps
# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_copr_chroot_safe [as 别名]
def render_chroot_view_comps(copr, chroot_name):
chroot = ComplexLogic.get_copr_chroot_safe(copr, chroot_name)
return Response(chroot.comps or "", mimetype="text/plain; charset=utf-8")
示例5: copr_chroot_details
# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_copr_chroot_safe [as 别名]
def copr_chroot_details(copr, chrootname):
chroot = ComplexLogic.get_copr_chroot_safe(copr, chrootname)
output = {'output': 'ok', 'buildroot_pkgs': chroot.buildroot_pkgs}
return flask.jsonify(output)