From d58a09deff2f07f3b07948344e82f1df539a3ac5 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 26 May 2011 11:57:48 +0200 Subject: [PATCH] [IMP] t-set="" value is now considered as an expression allowing things like t-set="object.prop" bzr revid: fme@openerp.com-20110526095748-z7g97pmfnpr14no3 --- addons/base/static/lib/qweb/qweb2.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/base/static/lib/qweb/qweb2.js b/addons/base/static/lib/qweb/qweb2.js index e5476d599bd..5067d30d70e 100644 --- a/addons/base/static/lib/qweb/qweb2.js +++ b/addons/base/static/lib/qweb/qweb2.js @@ -2,7 +2,7 @@ // TODO: line number -> https://bugzilla.mozilla.org/show_bug.cgi?id=618650 var QWeb2 = { expressions_cache: {}, - reserved_words: 'true,false,NaN,null,undefined,debugger,in,instanceof,new,function,return,this,typeof,eval,Math,RegExp,Array,Object'.split(','), + reserved_words: 'true,false,NaN,null,undefined,debugger,in,instanceof,new,function,return,this,typeof,eval,Math,RegExp,Array,Object,Date'.split(','), actions_precedence: 'foreach,if,call,set,esc,escf,raw,rawf,js,debug,log'.split(','), word_replacement: { 'and': '&&', @@ -635,17 +635,18 @@ QWeb2.Element = (function() { } }, compile_action_set : function(value) { + var variable = this.format_expression(value); if (this.actions['value']) { - this.top("dict['" + value + "'] = (" + (this.format_expression(this.actions['value'])) + ");"); + this.top(variable + " = (" + (this.format_expression(this.actions['value'])) + ");"); this.process_children = false; } else { if (this.children.length === 0) { - this.top("dict['" + value + "'] = '';"); + this.top(variable + " = '';"); } else if (this.children.length === 1 && this.children[0].node.nodeType === 3) { - this.top("dict['" + value + "'] = " + (this.engine.tools.js_escape(this.children[0].node.data)) + ";"); + this.top(variable + " = " + (this.engine.tools.js_escape(this.children[0].node.data)) + ";"); this.process_children = false; } else { - this.top("dict['" + value + "'] = (function(dict) {"); + this.top(variable + " = (function(dict) {"); this.bottom("})(dict);"); this.indent(); this.top("var r = [];");