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


Python ComplexLogic.get_package_safe方法代码示例

本文整理汇总了Python中coprs.logic.complex_logic.ComplexLogic.get_package_safe方法的典型用法代码示例。如果您正苦于以下问题:Python ComplexLogic.get_package_safe方法的具体用法?Python ComplexLogic.get_package_safe怎么用?Python ComplexLogic.get_package_safe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在coprs.logic.complex_logic.ComplexLogic的用法示例。


在下文中一共展示了ComplexLogic.get_package_safe方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: copr_edit_package

# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_package_safe [as 别名]
def copr_edit_package(copr, package_name, source_type=None, **kwargs):
    package = ComplexLogic.get_package_safe(copr, package_name)
    data = package.source_json_dict
    data["webhook_rebuild"] = package.webhook_rebuild

    if package.source_type and not source_type:
        source_type = package.source_type_text
    elif not source_type:
        source_type = "git_and_tito"

    form_classes = {
        "git_and_tito": forms.PackageFormTito,
        "mock_scm": forms.PackageFormMock,
        "pypi": forms.PackageFormPyPI,
    }
    form = {k: v(formdata=None) for k, v in form_classes.items()}

    if "form" in kwargs:
        form[kwargs["form"].source_type.data] = kwargs["form"]
    elif package.source_type:
        if package.source_type_text == "git_and_tito" and "git_dir" in data:
            data["git_directory"] = data["git_dir"]  # @FIXME workaround
        form[package.source_type_text] = form_classes[package.source_type_text](data=data)

    return flask.render_template("coprs/detail/package_edit.html", package=package, copr=copr,
                                 source_type=source_type, view="coprs_ns.copr_edit_package",
                                 form_tito=form["git_and_tito"], form_mock=form["mock_scm"], form_pypi=form["pypi"])
开发者ID:0-T-0,项目名称:copr,代码行数:29,代码来源:coprs_packages.py

示例2: render_package_edit

# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_package_safe [as 别名]
def render_package_edit(copr, package_name, view, form_tito=None, form_mock=None):
    package = ComplexLogic.get_package_safe(copr, package_name)
    if not form_tito:
        data = package.source_json_dict
        if "git_dir" in data:
            data["git_directory"] = data["git_dir"]  # @FIXME workaround
        form_tito = forms.PackageFormTitoFactory.create_form_cls()(data=data)

    if not form_mock:
        data = package.source_json_dict
        form_mock = forms.PackageFormMockFactory.create_form_cls()(data=data)

    return flask.render_template("coprs/detail/package_edit.html", package=package, copr=copr, form_tito=form_tito,
                                 form_mock=form_mock, view=view)
开发者ID:evilkost,项目名称:copr,代码行数:16,代码来源:coprs_builds.py

示例3: render_copr_package_rebuild

# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_package_safe [as 别名]
def render_copr_package_rebuild(copr, package_name, view):
    package = ComplexLogic.get_package_safe(copr, package_name)
    data = package.source_json_dict

    if package.source_type_text == "git_and_tito":
        data["git_directory"] = data["git_dir"]  # @FIXME workaround
        form = forms.BuildFormTitoFactory
        f = render_add_build_tito
        view_suffix = "_tito"
    elif package.source_type_text == "mock_scm":
        form = forms.BuildFormMockFactory
        f = render_add_build_mock
        view_suffix = "_mock"

    form = form.create_form_cls(copr.active_chroots)(data=data)
    return f(copr, form, view=view + view_suffix)
开发者ID:evilkost,项目名称:copr,代码行数:18,代码来源:coprs_builds.py

示例4: copr_rebuild_package

# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_package_safe [as 别名]
def copr_rebuild_package(copr, package_name):
    package = ComplexLogic.get_package_safe(copr, package_name)
    data = package.source_json_dict

    if package.source_type_text == "git_and_tito":
        data["git_directory"] = data["git_dir"]  # @FIXME workaround
        form = forms.BuildFormTitoFactory
        f = render_add_build_tito
        view_suffix = "_tito"
    elif package.source_type_text == "mock_scm":
        form = forms.BuildFormMockFactory
        f = render_add_build_mock
        view_suffix = "_mock"
    elif package.source_type_text == "pypi":
        form = forms.BuildFormPyPIFactory
        f = render_add_build_pypi
        view_suffix = "_pypi"
    else:
        flask.flash("Package {} has not the default source which is required for rebuild. Please configure some source"
                    .format(package_name, copr.full_name))
        return flask.redirect(helpers.copr_url("coprs_ns.copr_edit_package", copr, package_name=package_name))

    form = form(copr.active_chroots)(data=data)
    return f(copr, form, view="coprs_ns.copr_new_build" + view_suffix, package=package)
开发者ID:0-T-0,项目名称:copr,代码行数:26,代码来源:coprs_packages.py

示例5: copr_package

# 需要导入模块: from coprs.logic.complex_logic import ComplexLogic [as 别名]
# 或者: from coprs.logic.complex_logic.ComplexLogic import get_package_safe [as 别名]
def copr_package(copr, package_name):
    package = ComplexLogic.get_package_safe(copr, package_name)
    return flask.render_template("coprs/detail/package.html", package=package, copr=copr)
开发者ID:0-T-0,项目名称:copr,代码行数:5,代码来源:coprs_packages.py


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