web.input() bugs for multiple select fields

112 views
Skip to first unread message

Vladimir Kirillov

unread,
Sep 19, 2010, 7:29:52 AM9/19/10
to web.py
Hello, web.py!

Got a bug in web.input().
Case:
form contains is a select multiple field with name 'mselect', the POST
data looks like this (which is ok in web.data()):
mselect=1&mselect=2&mselect=3

web.input() filters out that data in storify() because defaults dict
does not have the key with expected list type.

utils.py, storify();
stor = Storage()
for key in requireds + tuple(mapping.keys()):
value = mapping[key]
if isinstance(value, list):
if isinstance(defaults.get(key), list): # <<< here
value = [getvalue(x) for x in value]
else:
value = value[-1]

This can be workarounded by supplying the expected key to the defaults
as list, i.e.:
web.input(mselect=[]).

Hope this gets fixed.
Thanks!

ps.
please cc: me

Anand Chitipothu

unread,
Sep 19, 2010, 9:06:35 AM9/19/10
to we...@googlegroups.com
2010/9/19 Vladimir Kirillov <pro...@hackndev.com>:

That is the expected behavior. Try using web.raw_input() if you want
to avoid going through storify.

Reply all
Reply to author
Forward
0 new messages