Now has a good amd wrapper for qweb

bzr revid: nicolas.vanhoren@openerp.com-20130819122459-45alsxp7m8zphc6v
This commit is contained in:
niv-openerp
2013-08-19 14:24:59 +02:00
parent 6badbe9253
commit 2f0e54db9d
3 changed files with 15 additions and 13 deletions
+8 -1
View File
@@ -1,4 +1,8 @@
(function() {
var tmpQWeb2 = window.QWeb2;
require.config({
context: "oelivesupport",
baseUrl: {{url | json}},
@@ -18,7 +22,8 @@ require.config({
},
qweb2: {
init: function() {
// TODO: better solution to avoid contamination of global namespace
var QWeb2 = window.QWeb2;
window.QWeb2 = tmpQWeb2;
return QWeb2;
},
},
@@ -37,3 +42,5 @@ require.config({
userName: {{userName | json}} || undefined,
});
});
})();
@@ -1,12 +0,0 @@
import sys
import json
file_name = sys.argv[1]
function_name = sys.argv[2]
with open(file_name) as file_:
content = file_.read()
print "window.%s(%s);" % (function_name, json.dumps(content))
@@ -25,6 +25,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// TODO: line number -> https://bugzilla.mozilla.org/show_bug.cgi?id=618650
// TODO: templates orverwritten could be called by t-call="__super__" ?
// TODO: t-set + t-value + children node == scoped variable ?
(function() {
var QWeb2 = {
expressions_cache: {},
RESERVED_WORDS: 'true,false,NaN,null,undefined,debugger,console,window,in,instanceof,new,function,return,this,typeof,eval,void,Math,RegExp,Array,Object,Date'.split(','),
@@ -727,3 +730,7 @@ QWeb2.Element = (function() {
});
return Element;
})();
window.QWeb2 = QWeb2;
})();