当前位置: 首页>>代码示例>>Python>>正文


Python ComplexLogic.get_copr_chroot_safe方法代码示例

本文整理汇总了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)
开发者ID:ignatenkobrain,项目名称:copr,代码行数:15,代码来源:api_general.py

示例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))
开发者ID:0-T-0,项目名称:copr,代码行数:17,代码来源:coprs_chroots.py

示例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)
开发者ID:0-T-0,项目名称:copr,代码行数:38,代码来源:coprs_chroots.py

示例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")
开发者ID:0-T-0,项目名称:copr,代码行数:5,代码来源:coprs_chroots.py

示例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)
开发者ID:ignatenkobrain,项目名称:copr,代码行数:6,代码来源:api_general.py


注:本文中的coprs.logic.complex_logic.ComplexLogic.get_copr_chroot_safe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。