def render_add_build_upload(copr, form, view): if not form: form = forms.BuildFormUploadFactory(copr.active_chroots)() return flask.render_template("coprs/detail/add_build/upload.html", copr=copr, form=form, view=view)
def process_new_build_upload(copr, add_view, url_on_success): def factory(**build_options): BuildsLogic.create_new_from_upload( flask.g.user, copr, f_uploader=lambda path: form.pkgs.data.save(path), orig_filename=form.pkgs.data.filename, chroot_names=form.selected_chroots, **build_options) form = forms.BuildFormUploadFactory(copr.active_chroots)() return process_new_build(copr, form, factory, render_add_build_upload, add_view, url_on_success)
def copr_new_build_upload(copr): form = forms.BuildFormUploadFactory( copr.active_chroots)(csrf_enabled=False) def create_new_build(): return BuildsLogic.create_new_from_upload( flask.g.user, copr, f_uploader=lambda path: form.pkgs.data.save(path), orig_filename=secure_filename(form.pkgs.data.filename), chroot_names=form.selected_chroots, ) return process_creating_new_build(copr, form, create_new_build)
def create_from_upload(): copr = get_copr() data = get_form_compatible_data() form = forms.BuildFormUploadFactory(copr.active_chroots)(data, meta={'csrf': False}) def create_new_build(): return BuildsLogic.create_new_from_upload( flask.g.user, copr, f_uploader=lambda path: form.pkgs.data.save(path), orig_filename=secure_filename(form.pkgs.data.filename), chroot_names=form.selected_chroots, background=form.background.data, copr_dirname=form.project_dirname.data, ) return process_creating_new_build(copr, form, create_new_build)