| |
@@ -1,6 +1,7 @@
|
| |
import flask
|
| |
- from . import query_params, get_copr, pagination, Paginator, GET, POST, PUT, DELETE
|
| |
- from .json2form import get_form_compatible_data, get_input_dict
|
| |
+ from coprs.views.apiv3_ns import (query_params, get_copr, pagination, Paginator,
|
| |
+ GET, POST, PUT, DELETE, set_defaults)
|
| |
+ from coprs.views.apiv3_ns.json2form import get_form_compatible_data, get_input_dict
|
| |
from coprs import db, models, forms
|
| |
from coprs.views.misc import api_login_required
|
| |
from coprs.views.apiv3_ns import apiv3_ns
|
| |
@@ -121,7 +122,9 @@
|
| |
def add_project(ownername):
|
| |
user, group = owner2tuple(ownername)
|
| |
data = rename_fields(get_form_compatible_data(preserve=["chroots"]))
|
| |
- form = forms.CoprFormFactory.create_form_cls(user=user, group=group)(data, meta={'csrf': False})
|
| |
+ form_class = forms.CoprFormFactory.create_form_cls(user=user, group=group)
|
| |
+ set_defaults(data, form_class)
|
| |
+ form = form_class(data, meta={'csrf': False})
|
| |
|
| |
if not form.validate_on_submit():
|
| |
raise BadRequest(form.errors)
|
| |
@@ -158,6 +161,8 @@
|
| |
multilib=form.multilib.data,
|
| |
module_hotfixes=form.module_hotfixes.data,
|
| |
fedora_review=form.fedora_review.data,
|
| |
+ follow_fedora_branching=form.follow_fedora_branching.data,
|
| |
+ runtime_dependencies=form.runtime_dependencies.data,
|
| |
)
|
| |
db.session.commit()
|
| |
except (DuplicateException,
|
| |
Fix #1747
The
test_update_copr_api3
test used web UI to create a newproject. I changed it to API, which revealed that
follow_fedora_branching
andruntime_dependencies
values weren'tset at all, so I fixed it and updated the test.
The behavior of
default
form values is terribly confusing to me, Idescribed my observations in the
set_defaults
function. It mightbe wrong though.
Also, please note that the #1747 issue cannot be reproduced via
and neither it can't be reproduced via
because both of them send a complete
CoprForm
data. It can bereproduced only the way this test works, i.e. sending a subset of
CoprForm
to/api_3/project/add/<NAME>
.