[FIX] don't forget to set py.bool in context of py.eval/py.evaluate

py.eval really needs to automatically have builtins in its evaluation context...

lp bug: https://launchpad.net/bugs/922651 fixed

bzr revid: xmo@openerp.com-20120130085557-oqmjs0owgdrwshu0
This commit is contained in:
Xavier Morel 2012-01-30 09:55:57 +01:00
parent ffbff476df
commit b50afe59fb
2 changed files with 2 additions and 2 deletions

View File

@ -158,7 +158,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
var pair = this.colors[i],
color = pair[0],
expression = pair[1];
if (py.evaluate(expression, context)) {
if (py.evaluate(expression, _.extend({bool: py.bool}, context))) {
return 'color: ' + color + ';';
}
// TODO: handle evaluation errors

View File

@ -146,7 +146,7 @@ openerp.web.TreeView = openerp.web.View.extend(/** @lends openerp.web.TreeView#
var pair = this.colors[i],
color = pair[0],
expression = pair[1];
if (py.evaluate(expression, context)) {
if (py.evaluate(expression, _.extend({bool: py.bool}, context))) {
return 'color: ' + color + ';';
}
// TODO: handle evaluation errors