def render_add_build_pypi(copr, form, view, package=None): if not form: form = forms.BuildFormPyPIFactory(copr.active_chroots)() return flask.render_template("coprs/detail/add_build/pypi.html", copr=copr, form=form, view=view, package=package)
def process_new_build_pypi(copr, add_view, url_on_success): def factory(**build_options): BuildsLogic.create_new_from_pypi( flask.g.user, copr, form.pypi_package_name.data, form.pypi_package_version.data, form.spec_template.data, form.python_versions.data, form.selected_chroots, **build_options) form = forms.BuildFormPyPIFactory(copr.active_chroots)() return process_new_build(copr, form, factory, render_add_build_pypi, add_view, url_on_success)
def copr_new_build_pypi(copr): form = forms.BuildFormPyPIFactory(copr.active_chroots)(csrf_enabled=False) # TODO: automatically prepopulate all form fields with their defaults if not form.python_versions.data: form.python_versions.data = form.python_versions.default def create_new_build(): return BuildsLogic.create_new_from_pypi( flask.g.user, copr, form.pypi_package_name.data, form.pypi_package_version.data, form.python_versions.data, form.selected_chroots, ) return process_creating_new_build(copr, form, create_new_build)
def create_from_pypi(): copr = get_copr() data = MultiDict(json2form.without_empty_fields(json2form.get_input())) form = forms.BuildFormPyPIFactory(copr.active_chroots)(data, meta={'csrf': False}) # TODO: automatically prepopulate all form fields with their defaults if not form.python_versions.data: form.python_versions.data = form.python_versions.default def create_new_build(): return BuildsLogic.create_new_from_pypi( flask.g.user, copr, form.pypi_package_name.data, form.pypi_package_version.data, form.spec_template.data, form.python_versions.data, form.selected_chroots, background=form.background.data, copr_dirname=form.project_dirname.data, ) return process_creating_new_build(copr, form, create_new_build)