cubicweb #1624937 [form handling] easy access to form values [resolved]

While working recently on an ad-hoc form I noticed it was a bit hard to round-trip from _cw.form values to the actual form values.

Either this is because of an API I'm not aware of, in which case we should add it to the cw doc, or we should provide an API to build a dictionary from _cw.form that extracts and preprocesses the values therein in a way which helps writing a proper form/controller/... form/... loop.

e.g:

{'foo': u'__internal_field_value', 'bar': u'42', 'baz': u''}

would become:

{'bar': [42], 'baz': None}

for a

class Form(...):

foo = ff.StringField(...) bar = ff.StringField(widget=fw.Select(multiple=True)) baz = ff.BooleanField(allo_none=True)

You get the idea. This could be a method on form such as:

form.process_form_values(self._cw.form)
prioritynormal
typeenhancement
done in3.13.1
load0.500
load left0.000
closed by<not specified>