So .. After some investigation, this is probably a problem related
to web.input's interpretation when the form is filled.
When a checkbox is checked, web.input() contains this:
<Storage {'french': u'mustard', 'curly': u'', 'moe': u'', 'bax':
u'', 'boe': u''}>
On the other side, when it's not checked, the curly key simply
disappears:
<Storage {'french': u'mustard', 'moe': u'', 'bax': u'', 'boe':
u''}>
I presume that the form is filled using the keys found in
web.input() instead of using the list of inputs of the form itself,
I didn't put the finger on the exact place where it stands :-[
I'm trying to write the smallest patch for form.py, but I'm not the
python's superheroe I would dream of, so I have to work a little on
that. ;)
Before I find the holy grail, you might fix this behaviour on your
side reading the keys of web.input and checking the checkbox by
yourself (always on the example...) :
def POST(self):
form = myform()
if not form.validates():
if 'curly' in
web.input():
form['curly'].set_value(True)
return render.formtest(form)
else:
# form.d.boe and form['boe'].value are
equivalent ways of
# extracting the validated arguments from the
form.
return "Grrreat success! boe: %s, bax: %s" %
(form.d.boe, form['bax'].value)
This seems to give pretty good results here :)
Regards,
Christophe.