I've noticed that recent versions of web2py (1.85) create a different
string in DB when form with checkboxes is serialised (compared to
version 1.77).

db.define_table("aaa", db.Field("bbb"), migrate=False)

db.aaa.bbb.widget = SQLFORM.widgets.checkboxes.widget
db.aaa.bbb.requires = [IS_IN_SET(BBB_VALUES, multiple=True),
IS_NOT_EMPTY()]

Before what was stored in DB was a '|' separated list of checked
options:
|xxx|yyy|zzz|
Now, it is a serialisation of a python list:
['xxx','yyy','zzz']

Obviously this breaks compatibility when I read the field from DB and
try to parse the options.

Interestingly setting default options on form display works "the old
way":
form=SQLFORM(db.aaa)
form.vars.bbb = "|".join(BBB_VALUES)

Reply via email to