diff options
| author | Thomas Groutars <tgr@odoo.com> | 2015-03-29 16:16:32 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2015-11-19 13:54:26 +0100 |
| commit | b665478fa760909b74d4b4bae69700c796ecb72c (patch) | |
| tree | ae7f6978c638a1f2ce1ee16b9b9d7f84697b81b4 /addons/web/static | |
| parent | f57e580f2dd976d217ca37b67d1583d6f2c152f0 (diff) | |
[FIX] py.js: unhandled prefix `not`
closes #6129
Diffstat (limited to 'addons/web/static')
| -rw-r--r-- | addons/web/static/lib/py.js/lib/py.js | 4 | ||||
| -rw-r--r-- | addons/web/static/test/evals.js | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/addons/web/static/lib/py.js/lib/py.js b/addons/web/static/lib/py.js/lib/py.js index ed5657c8f3b..a940299a5c5 100644 --- a/addons/web/static/lib/py.js/lib/py.js +++ b/addons/web/static/lib/py.js/lib/py.js @@ -317,10 +317,10 @@ var py = {}; } else if (token in symbols) { var symbol; // transform 'not in' and 'is not' in a single token - if (token === 'in' && tokens[tokens.length-1].id === 'not') { + if (token === 'in' && tokens.length > 1 && tokens[tokens.length-1].id === 'not') { symbol = symbols['not in']; tokens.pop(); - } else if (token === 'not' && tokens[tokens.length-1].id === 'is') { + } else if (token === 'not' && tokens.length > 1 && tokens[tokens.length-1].id === 'is') { symbol = symbols['is not']; tokens.pop(); } else { diff --git a/addons/web/static/test/evals.js b/addons/web/static/test/evals.js index a85f973e874..ff97086b019 100644 --- a/addons/web/static/test/evals.js +++ b/addons/web/static/test/evals.js @@ -1,3 +1,16 @@ +openerp.testing.section('eval.basics', { + dependencies: ['web.core'], + setup: function (instance) { + instance.session.uid = 42; + } +}, function (test) { + test('not prefix', function (instance) { + ok(py.eval('not False')); + ok(py.eval('not foo', {foo: false})); + ok(py.eval('not a in b', {a: 3, b: [1, 2, 4, 8]})); + }); +}); + openerp.testing.section('eval.types', { dependencies: ['web.core'], setup: function (instance) { |
