[IMP] now uses py.eval for options

bzr revid: nicolas.vanhoren@openerp.com-20121011125748-8au3gmss2436h5lw
This commit is contained in:
niv-openerp 2012-10-11 14:57:48 +02:00
parent dcae3b64a3
commit c538db258a
2 changed files with 5 additions and 5 deletions

View File

@ -1440,6 +1440,10 @@ instance.web.JsonRPC = instance.web.CallbackEnabled.extend({
},
});
instance.web.py_eval = function(expr, context) {
return py.eval(expr, _.extend({}, context || {}, {"true": true, "false": false, "null": null}));
};
}
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:

View File

@ -2087,11 +2087,7 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w
this.field = this.field_manager.get_field_desc(this.name);
this.widget = this.node.attrs.widget;
this.string = this.node.attrs.string || this.field.string || this.name;
try {
this.options = JSON.parse(this.node.attrs.options || '{}');
} catch (e) {
throw new Error(_.str.sprintf(_t("Widget options for field '%s' are not valid JSON."), this.name));
}
this.options = instance.web.py_eval(this.node.attrs.options || '{}');
this.set({'value': false});
this.on("change:value", this, function() {