← Back to team overview

openerp-dev-web team mailing list archive

lp:~openerp-dev/openobject-client-web/proto61-qweb-namespaces-xmo into lp:~openerp-dev/openobject-client-web/trunk-proto61

 

Xavier (Open ERP) has proposed merging lp:~openerp-dev/openobject-client-web/proto61-qweb-namespaces-xmo into lp:~openerp-dev/openobject-client-web/trunk-proto61 with lp:~openerp-dev/openobject-client-web/proto61-qweb-tests-and-fixes-xmo as a prerequisite.

Requested reviews:
  Antony Lesuisse (al-openerp)
  Fabien Meghazi (OpenERP) (fme)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/proto61-qweb-namespaces-xmo/+merge/53203
-- 
https://code.launchpad.net/~openerp-dev/openobject-client-web/proto61-qweb-namespaces-xmo/+merge/53203
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-client-web/proto61-qweb-tests-and-fixes-xmo.
=== modified file 'addons/base/static/openerp/base.xml'
--- addons/base/static/openerp/base.xml	2011-03-09 15:59:44 +0000
+++ addons/base/static/openerp/base.xml	2011-03-14 08:44:59 +0000
@@ -1,8 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <!-- vim:fdl=1:
 -->
-<templates id="template" xml:space="preserve">
-<t t-name="Interface">
+<t:templates id="template" xml:space="preserve" xmlns:t="qweb">
+<t:template name="Interface">
     <div id="oe_loading" class="loading"></div>
     <div id="oe_login" class="login"></div>
     <div id="oe_header" class="header"></div>
@@ -17,18 +16,18 @@
     <div style="position: absolute; right: 2px; top: 38px;">
         <button onclick="QWeb.add_template('base.xml'); $('body').css('background-color', '#FFFF9C'); setTimeout(function() { $('body').css('background-color', '#FFF'); }, 500);">Reload QWEB</button>
     </div>
-</t>
-<t t-name="Loading">
+</t:template>
+<t:template name="Loading">
     Loading...
-</t>
-<t t-name="Login">
+</t:template>
+<t:template name="Login">
     <form>
         Login: <input type="text" name="login" value="admin"/><br/>
         Password: <input type="password" name="password" value="a"/><br/>
         <input type="submit" name="submit" value="Login"/>
     </form>
-</t>
-<t t-name="Header">
+</t:template>
+<t:template name="Header">
     <a href="/" class="company_logo_link">
         <img src="/base/static/openerp/img/logo.png" border="0" class="company_logo"/>
     </a>
@@ -59,31 +58,28 @@
         </div>
 
     </div>
-</t>
-<t t-name="Menu.root">
+</t:template>
+<t:template name="Menu.root">
     <ul class="sf-menu">
-    <t t-foreach="data.children" t-as="menu">
-        <t t-call="Menu.children"/>
-    </t>
+    <t:d foreach="data.children" as="menu">
+        <t:d call="Menu.children"/>
+    </t:d>
     </ul>
     <div style="clear: both"></div>
-</t>
-<t t-name="Menu.children">
+</t:template>
+<t:template name="Menu.children">
     <!-- TODO prefix id with the element_id of the controller -->
-    <li><a href="#" t-attf-id="menu_#{menu.id}"><t t-esc="menu.name"/></a>
-        <t t-if="menu.children.length!=0">
+    <li><a href="#" t:attf-id="menu_#{menu.id}"><t:d out="menu.name"/></a>
+        <t:d if="menu.children.length!=0">
             <ul>
-                <t t-foreach="menu.children" t-as="menu">
-                    <t t-call="Menu.children"/>
-                </t>
+                <t:d foreach="menu.children" as="menu">
+                    <t:d call="Menu.children"/>
+                </t:d>
             </ul>
-        </t>
+        </t:d>
     </li>
-</t>
-<t t-name="ListView">
-    <!--
-    <h3><t t-esc="fields_view.arch['@string']"/></h3>
-    -->
+</t:template>
+<t:template name="ListView">
     <div style="text-align:right;">
         <input type="button" value="First"/>
         <input type="button" value="&lt;&lt;"/>
@@ -92,9 +88,9 @@
         <input type="button" value="Last"/>
     </div>
     <table id="todo_use_unique_id" class="jqGrid"></table>
-</t>
-<t t-name="FormView">
-    <h3 class="title"><t t-esc="fields_view.arch.attrs.string"/></h3>
+</t:template>
+<t:template name="FormView">
+    <h3 class="title"><t:d out="fields_view.arch.attrs.string"/></h3>
     <div style="text-align:right;">
         <input type="button" value="First"/>
         <input type="button" value="&lt;&lt;"/>
@@ -102,98 +98,85 @@
         <input type="button" value="&gt;&gt;"/>
         <input type="button" value="Last"/>
     </div>
-    <t t-call="FormView.node">
-        <t t-set="node" t-value="fields_view.arch"/>
-    </t>
+    <t:d call="FormView.node">
+        <t:d set="node" value="fields_view.arch"/>
+    </t:d>
     <div style="text-align:right;">
         <input type="button" value="Save"/>
     </div>
-</t>
-<t t-name="FormView.node">
-    <!--
-    tag: <t t-esc="node.tag"/> <t t-esc="node['@name']"/> <br/>
-    <t t-if="node.tag == 'filter'">
-        <input type="button" t-att-value="node['@string']"/>
-        <t t-esc="node['@name']"/>
-        <br/>
-    </t>
-    <t t-if="node.tag == 'separator'">
-        <hr/>
-        <t t-esc="node['@name']"/>
-        <t t-esc="node['@string']"/>
-    </t>
-    -->
-    <t t-if="node.tag == 'field'">
-        <t t-esc="node.attrs.string"/>
-        <t t-esc="node.attrs.name"/>
-        <input type="text" t-att-name="node.attrs.name"/>
-        <br/>
-    </t>
-    <t t-foreach="node.children || []" t-as="node">
-        <t t-call="FormView.node"/>
-    </t>
-</t>
-<t t-name="SearchView">
+</t:template>
+<t:template name="FormView.node">
+    <t:d if="node.tag == 'field'">
+        <t:d out="node.attrs.string"/>
+        <t:d out="node.attrs.name"/>
+        <input type="text" t:att-name="node.attrs.name"/>
+        <br/>
+    </t:d>
+    <t:d foreach="node.children || []" as="node">
+        <t:d call="FormView.node"/>
+    </t:d>
+</t:template>
+<t:template name="SearchView">
     <h3 class="title"><t t-esc="fields_view.arch.attrs['string']"/></h3>
     <table border="0" cellspacing="0" cellpadding="0">
     <tr>
-        <t t-call="SearchView.node">
-            <t t-set="node" t-value="fields_view.arch"/>
-            <t t-set="previous_node_type"></t>
-        </t>
+        <t:d call="SearchView.node">
+            <t:d set="node" value="fields_view.arch"/>
+            <t:d set="previous_node_type"></t:d>
+        </t:d>
     </tr>
     </table>
     <div style="text-align:right;">
         <input id="search" type="button" value="Search"/>
         <input type="button" value="Clear"/>
     </div>
-</t>
-<t t-name="SearchView.node" t-trim="inner">
-    <t t-if="node.tag == 'filter'">
-        <t t-if="previous_node_type != 'filter'">
+</t:template>
+<t:template name="SearchView.node" trim="inner">
+    <t:d if="node.tag == 'filter'">
+        <t:d if="previous_node_type != 'filter'">
             &lt;td nowrap="true" valign="bottom" class="filter_label_group"&gt;
-        </t>
-            <button type="button" t-att-title="node.attrs.help" t-att-class="node.attrs.string ? 'filter_label' : 'filter_icon'">
-                <img t-if="node.attrs.icon" t-att-src="'/base/static/openerp/img/icons/' + node.attrs.icon + '.png'" width="16" height="16"/>
-                <br t-if="node.attrs.icon and node.attrs.string"/>
-                <t t-esc="node.attrs.string"/>
+        </t:d>
+            <button type="button" t:att-title="node.attrs.help" t:att-class="node.attrs.string ? 'filter_label' : 'filter_icon'">
+                <img t:if="node.attrs.icon" t:att-src="'/base/static/openerp/img/icons/' + node.attrs.icon + '.png'" width="16" height="16"/>
+                <br t:if="node.attrs.icon and node.attrs.string"/>
+                <t:d out="node.attrs.string"/>
             </button>
-        <t t-if="next_node_type != 'filter'">
+        <t:d if="next_node_type != 'filter'">
             &lt;/td&gt;
-        </t>
-    </t>
-    <t t-if="node.tag == 'separator'">
+        </t:d>
+    </t:d>
+    <t:d if="node.tag == 'separator'">
         <!-- nothing in search view ? -->
-    </t>
-    <t t-if="node.tag == 'newline'">
+    </t:d>
+    <t:d if="node.tag == 'newline'">
         <!-- TODO: check qweb support for cdata -->
         &lt;/tr&gt;
         &lt;/table&gt;
         &lt;table border="0" cellspacing="0" cellpadding="0"&gt;
         &lt;tr&gt;
-    </t>
-    <t t-if="node.tag == 'field'">
-        <t t-set="orm" t-value="fields_view.fields[node.attrs.name] || {}"/>
+    </t:d>
+    <t:d if="node.tag == 'field'">
+        <t:d set="orm" value="fields_view.fields[node.attrs.name] || {}"/>
         <td>
-            <label style="display: block" t-att-title="orm.help || node.attrs.help">
-                <t t-esc="orm.string || node.attrs.string || node.attrs.name"/>
-                <span t-if="orm.help || node.attrs.help">(?)</span>
+            <label style="display: block" t:att-title="orm.help || node.attrs.help">
+                <t:d out="orm.string || node.attrs.string || node.attrs.name"/>
+                <span t:if="orm.help || node.attrs.help">(?)</span>
             </label>
             <div>
-                <input type="text" t-att-name="node.attrs.name"/>
+                <input type="text" t:att-name="node.attrs.name"/>
             </div>
         </td>
-    </t>
-    <t t-if="node.tag == 'group'">
+    </t:d>
+    <t:d if="node.tag == 'group'">
         <!-- if group is called without a <newline/> before, the table should be closed.
             I think we'll need preprocessing, all those escaped tables are too ugly -->
         <td>
-            <div t-att-class="'searchview_group ' + (node.attrs.expand == '0' ? 'folded' : 'expanded')">
-                <a class="searchview_group_string" href="#" onclick="$(this).parent().toggleClass('folded expanded')"><t t-esc="node.attrs.string"/></a>
+            <div t:att-class="'searchview_group ' + (node.attrs.expand == '0' ? 'folded' : 'expanded')">
+                <a class="searchview_group_string" href="#" onclick="$(this).parent().toggleClass('folded expanded')"><t:d out="node.attrs.string"/></a>
                 <div class="searchview_group_content">
                     <table border="0" cellspacing="0" cellpadding="0">
                     <tr>
-                        <t t-call="SearchView.recurse"/>
+                        <t:d call="SearchView.recurse"/>
                     </tr>
                     </table>
                 </div>
@@ -203,20 +186,20 @@
         &lt;/table&gt;
         &lt;table border="0" cellspacing="0" cellpadding="0"&gt;
         &lt;tr&gt;
-    </t>
-    <t t-if="node.children and node.tag != 'newline' and node.tag != 'group'">
-        <t t-call="SearchView.recurse"/>
-    </t>
-</t>
-<t t-name="SearchView.recurse" t-trim="inner">
-    <t t-foreach="node.children" t-as="node">
-        <t t-call="SearchView.node">
-            <t t-set="previous_node_type" t-value="node_all[node_index - 1] ? node_all[node_index - 1].tag : ''"/>
-            <t t-set="next_node_type" t-value="node_all[node_index + 1] ? node_all[node_index + 1].tag : ''"/>
-        </t>
-    </t>
-</t>
-<t t-name="Action">
+    </t:d>
+    <t:d if="node.children and node.tag != 'newline' and node.tag != 'group'">
+        <t:d call="SearchView.recurse"/>
+    </t:d>
+</t:template>
+<t:template name="SearchView.recurse" trim="inner">
+    <t:d foreach="node.children" as="node">
+        <t:d call="SearchView.node">
+            <t:d set="previous_node_type" value="node_all[node_index - 1] ? node_all[node_index - 1].tag : ''"/>
+            <t:d set="next_node_type" value="node_all[node_index + 1] ? node_all[node_index + 1].tag : ''"/>
+        </t:d>
+    </t:d>
+</t:template>
+<t:template name="Action">
     <!-- TODO prefix id with the element_id of the controller t-attf-id="#{prefix}_localid" -->
     <div style="text-align:right;">
         <input id="mode_list" type="button" value="ListView"/>
@@ -226,5 +209,5 @@
     <div id="oe_action_search" ></div>
     <div id="oe_action_list" ></div>
     <div id="oe_action_form" ></div>
-</t>
-</templates>
+</t:template>
+</t:templates>

=== modified file 'addons/base/static/qweb/qweb-test-attributes.xml'
--- addons/base/static/qweb/qweb-test-attributes.xml	2011-03-14 08:44:59 +0000
+++ addons/base/static/qweb/qweb-test-attributes.xml	2011-03-14 08:44:59 +0000
@@ -1,22 +1,22 @@
-<templates>
-    <t t-name="fixed-literal">
-        <div t-att-foo="'bar'"/>
-    </t>
-    <t t-name="fixed-variable">
-        <div t-att-foo="value"/>
-    </t>
-
-    <t t-name="tuple-literal">
-        <div t-att="['foo', 'bar']"/>
-    </t>
-    <t t-name="tuple-variable">
-        <div t-att="att"/>
-    </t>
-
-    <t t-name="format-literal">
-        <div t-attf-foo="bar"/>
-    </t>
-    <t t-name="format-value">
-        <div t-attf-foo="b#{value}r"/>
-    </t>
-</templates>
+<t:templates xmlns:t="qweb">
+    <t:template name="fixed-literal">
+        <div t:att-foo="'bar'"/>
+    </t:template>
+    <t:template name="fixed-variable">
+        <div t:att-foo="value"/>
+    </t:template>
+
+    <t:template name="tuple-literal">
+        <div t:att="['foo', 'bar']"/>
+    </t:template>
+    <t:template name="tuple-variable">
+        <div t:att="att"/>
+    </t:template>
+
+    <t:template name="format-literal">
+        <div t:attf-foo="bar"/>
+    </t:template>
+    <t:template name="format-value">
+        <div t:attf-foo="b#{value}r"/>
+    </t:template>
+</t:templates>

=== modified file 'addons/base/static/qweb/qweb-test-call.xml'
--- addons/base/static/qweb/qweb-test-call.xml	2011-03-14 08:44:59 +0000
+++ addons/base/static/qweb/qweb-test-call.xml	2011-03-14 08:44:59 +0000
@@ -1,30 +1,30 @@
-<templates>
-    <t t-name="basic-callee">ok</t>
-    <t t-name="callee-printsbody"><t t-esc="0"/></t>
-    <t t-name="callee-uses-foo"><t t-esc="foo"/></t>
-    <t t-name="callee-sets-foo"><t t-set="foo" t-value="'ok'"/></t>
+<t:templates xmlns:t="qweb">
+    <t:template name="basic-callee">ok</t:template>
+    <t:template name="callee-printsbody"><t:d out="0"/></t:template>
+    <t:template name="callee-uses-foo"><t:d out="foo"/></t:template>
+    <t:template name="callee-sets-foo"><t:d set="foo" value="'ok'"/></t:template>
 
-    <t t-name="basic-caller">
-        <t t-call="basic-callee"/>
-    </t>
-    <t t-name="with-unused-body">
-        <t t-call="basic-callee">WHEEE</t>
-    </t>
-    <t t-name="with-unused-setbody">
-        <t t-call="basic-callee">
-            <t t-set="qux" t-value="3"/>
-        </t>
-    </t>
-    <t t-name="with-used-body">
-        <t t-call="callee-printsbody">ok</t>
-    </t>
-    <t t-name="with-used-setbody">
-        <t t-call="callee-uses-foo">
-            <t t-set="foo" t-value="'ok'"/>
-        </t>
-    </t>
-    <t t-name="in-context-import">
-        <t t-call="callee-sets-foo" t-import='*'/>
-        <t t-esc="foo"/>
-    </t>
-</templates>
+    <t:template name="basic-caller">
+        <t:d call="basic-callee"/>
+    </t:template>
+    <t:template name="with-unused-body">
+        <t:d call="basic-callee">WHEEE</t:d>
+    </t:template>
+    <t:template name="with-unused-setbody">
+        <t:d call="basic-callee">
+            <t:d set="qux" value="3"/>
+        </t:d>
+    </t:template>
+    <t:template name="with-used-body">
+        <t:d call="callee-printsbody">ok</t:d>
+    </t:template>
+    <t:template name="with-used-setbody">
+        <t:d call="callee-uses-foo">
+            <t:d set="foo" value="'ok'"/>
+        </t:d>
+    </t:template>
+    <t:template name="in-context-import">
+        <t:d call="callee-sets-foo" import='*'/>
+        <t:d out="foo"/>
+    </t:template>
+</t:templates>

=== modified file 'addons/base/static/qweb/qweb-test-conditionals.xml'
--- addons/base/static/qweb/qweb-test-conditionals.xml	2011-03-14 08:44:59 +0000
+++ addons/base/static/qweb/qweb-test-conditionals.xml	2011-03-14 08:44:59 +0000
@@ -1,59 +1,59 @@
-<templates>
-    <t t-name="literal-conditional">
-        <t t-if="true">ok</t>
-    </t>
-    <t t-name="boolean-value-conditional">
-        <t t-if="value">ok</t>
-    </t>
-    <t t-name="boolean-value-conditional-false">
-        <t t-if="value">fail</t>
-    </t>
-
-    <t t-name="negify">
-        <t t-if="!false">ok</t>
-    </t>
-    <t t-name="equality">
-        <t t-if="1 == 1">ok</t>
-    </t>
-    <t t-name="difference">
-        <t t-if="1 != 2">ok</t>
-    </t>
-    <t t-name="and">
-        <t t-if="true and true">ok</t>
-    </t>
-    <t t-name="and-js">
-        <t t-if="true &amp;&amp; true">ok</t>
-    </t>
-    <t t-name="or">
-        <t t-if="false or true">ok</t>
-    </t>
-    <t t-name="or-js">
-        <t t-if="false || true">ok</t>
-    </t>
-
-    <t t-name="greater">
-        <t t-if="2 gt 1">ok</t>
-    </t>
-    <t t-name="greater-js">
-        <t t-if="2 &gt; 1">ok</t>
-    </t>
-    <t t-name="lower">
-        <t t-if="1 lt 2">ok</t>
-    </t>
-    <t t-name="lower-js">
-        <t t-if="1 &lt; 2">ok</t>
-    </t>
-
-    <t t-name="greater-or-equal">
-        <t t-if="2 gte 1">o</t><t t-if="2 gte 2">k</t>
-    </t>
-    <t t-name="greater-or-equal-js">
-        <t t-if="2 &gt;= 1">o</t><t t-if="2 &gt;= 2">k</t>
-    </t>
-    <t t-name="lower-or-equal">
-        <t t-if="1 lte 2">o</t><t t-if="2 lte 2">k</t>
-    </t>
-    <t t-name="lower-or-equal-js">
-        <t t-if="1 &lt;= 2">o</t><t t-if="2 &lt;= 2">k</t>
-    </t>
-</templates>
+<t:templates xmlns:t="qweb">
+    <t:template name="literal-conditional">
+        <t:d if="true">ok</t:d>
+    </t:template>
+    <t:template name="boolean-value-conditional">
+        <t:d if="value">ok</t:d>
+    </t:template>
+    <t:template name="boolean-value-conditional-false">
+        <t:d if="value">fail</t:d>
+    </t:template>
+
+    <t:template name="negify">
+        <t:d if="!false">ok</t:d>
+    </t:template>
+    <t:template name="equality">
+        <t:d if="1 == 1">ok</t:d>
+    </t:template>
+    <t:template name="difference">
+        <t:d if="1 != 2">ok</t:d>
+    </t:template>
+    <t:template name="and">
+        <t:d if="true and true">ok</t:d>
+    </t:template>
+    <t:template name="and-js">
+        <t:d if="true &amp;&amp; true">ok</t:d>
+    </t:template>
+    <t:template name="or">
+        <t:d if="false or true">ok</t:d>
+    </t:template>
+    <t:template name="or-js">
+        <t:d if="false || true">ok</t:d>
+    </t:template>
+
+    <t:template name="greater">
+        <t:d if="2 gt 1">ok</t:d>
+    </t:template>
+    <t:template name="greater-js">
+        <t:d if="2 &gt; 1">ok</t:d>
+    </t:template>
+    <t:template name="lower">
+        <t:d if="1 lt 2">ok</t:d>
+    </t:template>
+    <t:template name="lower-js">
+        <t:d if="1 &lt; 2">ok</t:d>
+    </t:template>
+
+    <t:template name="greater-or-equal">
+        <t:d if="2 gte 1">o</t:d><t:d if="2 gte 2">k</t:d>
+    </t:template>
+    <t:template name="greater-or-equal-js">
+        <t:d if="2 &gt;= 1">o</t:d><t:d if="2 &gt;= 2">k</t:d>
+    </t:template>
+    <t:template name="lower-or-equal">
+        <t:d if="1 lte 2">o</t:d><t:d if="2 lte 2">k</t:d>
+    </t:template>
+    <t:template name="lower-or-equal-js">
+        <t:d if="1 &lt;= 2">o</t:d><t:d if="2 &lt;= 2">k</t:d>
+    </t:template>
+</t:templates>

=== modified file 'addons/base/static/qweb/qweb-test-foreach.xml'
--- addons/base/static/qweb/qweb-test-foreach.xml	2011-03-14 08:44:59 +0000
+++ addons/base/static/qweb/qweb-test-foreach.xml	2011-03-14 08:44:59 +0000
@@ -1,40 +1,40 @@
-<templates>
-    <t t-name="repetition-text-content" t-trim="both">
-        <t t-foreach="seq">*</t>
-    </t>
-    <t t-name="repetition-dom-content" t-trim="both">
-        <t t-foreach="seq"><b/></t>
-    </t>
-    <t t-name="repetition-self" t-trim="both">
-        <b t-foreach="seq"/>
-    </t>
-
-    <t t-name="scope-self" t-trim="both">
-        <t t-foreach="seq"><t t-esc="seq"/></t>
-    </t>
-    <t t-name="scope-value" t-trim="both">
-        <t t-foreach="seq"><t t-esc="seq_value"/></t>
-    </t>
-    <t t-name="scope-index" t-trim="both">
-        <t t-foreach="seq"><t t-esc="seq_index"/></t>
-    </t>
-    <t t-name="scope-first" t-trim="both">
-        <t t-foreach="seq"><t t-esc="seq_first"/> </t>
-    </t>
-    <t t-name="scope-last" t-trim="both">
-        <t t-foreach="seq"><t t-esc="seq_last"/> </t>
-    </t>
-    <t t-name="scope-parity" t-trim="both">
-        <t t-foreach="seq"><t t-esc="seq_parity"/> </t>
-    </t>
-    <t t-name="scope-size" t-trim="both">
-        <t t-foreach="seq"><t t-esc="seq_size"/> </t>
-    </t>
-
-    <t t-name="aliasing" t-trim="both">
-        <t t-foreach="seq" t-as="item"><t t-esc="item"/></t>
-    </t>
-    <t t-name="loopvars-aliasing" t-trim="both">
-        <t t-foreach="seq" t-as="item"><t t-esc="item_parity"/> </t>
-    </t>
-</templates>
+<t:templates xmlns:t="qweb">
+    <t:template name="repetition-text-content" trim="both">
+        <t:d foreach="seq">*</t:d>
+    </t:template>
+    <t:template name="repetition-dom-content" trim="both">
+        <t:d foreach="seq"><b/></t:d>
+    </t:template>
+    <t:template name="repetition-self" trim="both">
+        <b t:foreach="seq"/>
+    </t:template>
+
+    <t:template name="scope-self" trim="both">
+        <t:d foreach="seq"><t:d out="seq"/></t:d>
+    </t:template>
+    <t:template name="scope-value" trim="both">
+        <t:d foreach="seq"><t:d out="seq_value"/></t:d>
+    </t:template>
+    <t:template name="scope-index" trim="both">
+        <t:d foreach="seq"><t:d out="seq_index"/></t:d>
+    </t:template>
+    <t:template name="scope-first" trim="both">
+        <t:d foreach="seq"><t:d out="seq_first"/> </t:d>
+    </t:template>
+    <t:template name="scope-last" trim="both">
+        <t:d foreach="seq"><t:d out="seq_last"/> </t:d>
+    </t:template>
+    <t:template name="scope-parity" trim="both">
+        <t:d foreach="seq"><t:d out="seq_parity"/> </t:d>
+    </t:template>
+    <t:template name="scope-size" trim="both">
+        <t:d foreach="seq"><t:d out="seq_size"/> </t:d>
+    </t:template>
+
+    <t:template name="aliasing" trim="both">
+        <t:d foreach="seq" as="item"><t:d out="item"/></t:d>
+    </t:template>
+    <t:template name="loopvars-aliasing" trim="both">
+        <t:d foreach="seq" as="item"><t:d out="item_parity"/> </t:d>
+    </t:template>
+</t:templates>

=== modified file 'addons/base/static/qweb/qweb-test-output.xml'
--- addons/base/static/qweb/qweb-test-output.xml	2011-03-14 08:44:59 +0000
+++ addons/base/static/qweb/qweb-test-output.xml	2011-03-14 08:44:59 +0000
@@ -1,51 +1,23 @@
-<templates>
+<t:templates xmlns:t="qweb">
     <!-- esc, evaluates and returns @t-esc after having xml-escaped it -->
-    <t t-name="esc-literal">
-        <t t-esc="'ok'"/>
-    </t>
-    <t t-name="esc-variable">
-        <t t-esc="ok"/>
-    </t>
-    <t t-name="esc-toescape">
-        <t t-esc="ok"/>
-    </t>
-
-    <!-- escf, same as t-esc, but @t-escf is a format string -->
-    <t t-name="escf-noformat-literal">
-        <t t-escf="ok"/>
-    </t>
-    <t t-name="escf-simpleformat-variable">
-        <t t-escf="#{value}"/>
-    </t>
-    <t t-name="escf-format-variable">
-        <t t-escf="[#{value}]"/>
-    </t>
-    <t t-name="escf-format-variable-with-escapes">
-        <t t-escf="[#{value}]"/>
-    </t>
+    <t:template name="esc-literal">
+        <t:d out="'ok'"/>
+    </t:template>
+    <t:template name="esc-variable">
+        <t:d out="ok"/>
+    </t:template>
+    <t:template name="esc-toescape">
+        <t:d out="ok"/>
+    </t:template>
 
     <!-- raw, evaluates and returns @t-raw directly (no escaping) -->
-    <t t-name="raw-literal">
-        <t t-raw="'ok'"/>
-    </t>
-    <t t-name="raw-variable">
-        <t t-raw="ok"/>
-    </t>
-    <t t-name="raw-notescaped">
-        <t t-raw="ok"/>
-    </t>
-
-    <!-- rawf, same as t-raw, but @t-rawf is a format string -->
-    <t t-name="rawf-noformat-literal">
-        <t t-escf="ok"/>
-    </t>
-    <t t-name="rawf-simpleformat-variable">
-        <t t-escf="#{value}"/>
-    </t>
-    <t t-name="rawf-format-variable">
-        <t t-escf="[#{value}]"/>
-    </t>
-    <t t-name="rawf-format-variable-notescaped">
-        <t t-rawf="[#{value}]"/>
-    </t>
-</templates>
+    <t:template name="raw-literal">
+        <t:d raw="'ok'"/>
+    </t:template>
+    <t:template name="raw-variable">
+        <t:d raw="ok"/>
+    </t:template>
+    <t:template name="raw-notescaped">
+        <t:d raw="ok"/>
+    </t:template>
+</t:templates>

=== modified file 'addons/base/static/qweb/qweb-test-set.xml'
--- addons/base/static/qweb/qweb-test-set.xml	2011-03-14 08:44:59 +0000
+++ addons/base/static/qweb/qweb-test-set.xml	2011-03-14 08:44:59 +0000
@@ -1,15 +1,15 @@
-<templates>
-    <t t-name="set-from-attribute-literal">
-        <t t-set="value" t-value="'ok'"/><t t-esc="value"/>
-    </t>
-    <t t-name="set-from-body-literal">
-        <t t-set="value">ok</t><t t-esc="value"/>
-    </t>
+<t:templates xmlns:t="qweb">
+    <t:template name="set-from-attribute-literal">
+        <t:d set="value" value="'ok'"/><t:d out="value"/>
+    </t:template>
+    <t:template name="set-from-body-literal">
+        <t:d set="value">ok</t:d><t:d out="value"/>
+    </t:template>
 
-    <t t-name="set-from-attribute-lookup">
-        <t t-set="stuff" t-value="value"/><t t-esc="stuff"/>
-    </t>
-    <t t-name="set-from-body-lookup">
-        <t t-set="stuff"><t t-esc="value"/></t><t t-esc="stuff"/>
-    </t>
-</templates>
+    <t:template name="set-from-attribute-lookup">
+        <t:d set="stuff" value="value"/><t:d out="stuff"/>
+    </t:template>
+    <t:template name="set-from-body-lookup">
+        <t:d set="stuff"><t:d out="value"/></t:d><t:d out="stuff"/>
+    </t:template>
+</t:templates>

=== modified file 'addons/base/static/qweb/qweb-test-trim.xml'
--- addons/base/static/qweb/qweb-test-trim.xml	2011-03-14 08:44:59 +0000
+++ addons/base/static/qweb/qweb-test-trim.xml	2011-03-14 08:44:59 +0000
@@ -1,19 +1,19 @@
-<templates>
-    <t t-name="trim-content-both" t-trim="both">
+<t:templates xmlns:t="qweb">
+    <t:template name="trim-content-both" trim="both">
         ok
-    </t>
-    <t t-name="trim-content-before" t-trim="left"> ok </t>
-    <t t-name="trim-content-after" t-trim="right"> ok </t>
-    <t t-name="trim-content-unknown" t-trim="stuff"> ok </t>
+    </t:template>
+    <t:template name="trim-content-before" trim="left"> ok </t:template>
+    <t:template name="trim-content-after" trim="right"> ok </t:template>
+    <t:template name="trim-content-unknown" trim="stuff"> ok </t:template>
 
-    <t t-name="trim-children-text" t-trim="inner">o k</t>
-    <t t-name="trim-children-elements" t-trim="inner">
+    <t:template name="trim-children-text" trim="inner">o k</t:template>
+    <t:template name="trim-children-elements" trim="inner">
         <foo/>
         <bar/>
-    </t>
-    <t t-name="trim-mixed-children" t-trim="inner">
+    </t:template>
+    <t:template name="trim-mixed-children" trim="inner">
         [ <foo/> ]
-    </t>
-    <t t-name='trim-children-left' t-trim="left inner"> <foo/> <bar/> </t>
-    <t t-name='trim-children-right' t-trim="right inner"> <foo/> <bar/> </t>
-</templates>
+    </t:template>
+    <t:template name='trim-children-left' trim="left inner"> <foo/> <bar/> </t:template>
+    <t:template name='trim-children-right' trim="right inner"> <foo/> <bar/> </t:template>
+</t:templates>

=== modified file 'addons/base/static/qweb/qweb-test.js.html'
--- addons/base/static/qweb/qweb-test.js.html	2011-03-14 08:44:59 +0000
+++ addons/base/static/qweb/qweb-test.js.html	2011-03-14 08:44:59 +0000
@@ -31,29 +31,11 @@
                 equals(render('esc-variable', {ok: 'ok'}), "ok", "Render a string variable");
                 equals(render('esc-toescape', {ok: '<ok>'}), "&lt;ok&gt;", "Render a string with data to escape");
             });
-            test("Formatted escaped output", function () {
-                equals(render('escf-noformat-literal', {}), "ok", "Render a literal string");
-                equals(render('escf-simpleformat-variable', {value: 'ok'}), "ok",
-                        "Only render an interpolated variable");
-                equals(render('escf-format-variable', {value: 'ok'}), "[ok]",
-                        "Actually formatted variable");
-                equals(render('escf-format-variable-with-escapes', {value: '<ok>'}), '[&lt;ok&gt;]',
-                        "Render a formatted string with data to escape");
-            });
             test("Basic unescaped output", function () {
                 equals(render('raw-literal', {}), "ok", "Render a literal string");
                 equals(render('raw-variable', {ok: 'ok'}), "ok", "Render a string variable");
                 equals(render('raw-notescaped', {ok: '<ok>'}), "<ok>", "Render a string with data not escaped");
             });
-            test("Formatted unescaped output", function () {
-                equals(render('rawf-noformat-literal', {}), "ok", "Render a literal string");
-                equals(render('rawf-simpleformat-variable', {value: 'ok'}), "ok",
-                        "Only render an interpolated variable");
-                equals(render('rawf-format-variable', {value: 'ok'}), "[ok]",
-                        "Actually formatted variable");
-                equals(render('rawf-format-variable-notescaped', {value: '<ok>'}), '[<ok>]',
-                        "Render a formatted string with data not escaped");
-            });
 
             module("Context-setting tests", {
                 setup: function () {

=== modified file 'addons/base/static/qweb/qweb.js'
--- addons/base/static/qweb/qweb.js	2011-03-14 08:44:59 +0000
+++ addons/base/static/qweb/qweb.js	2011-03-14 08:44:59 +0000
@@ -39,6 +39,7 @@
 
 var QWeb = {
     templates:{},
+    ns:'qweb',
     prefix:"t",
     reg:new RegExp(),
     tag:{},
@@ -47,6 +48,24 @@
         this.value = value;
         this.message = message;
     },
+    isElement: function (node) {
+        return (node.nodeType == 1);
+    },
+    isTemplate: function (element) {
+        return ((element.namespaceURI == this.ns
+                 && element.localName == 'template'
+                 && element.getAttributeNode('name'))
+                || element.getAttributeNodeNS(this.ns, 'template'));
+    },
+    addTemplate: function (element) {
+        var name;
+        if(element.namespaceURI == this.ns) {
+            name = element.getAttributeNode('name').value;
+        } else {
+            name = element.getAttributeNodeNS(this.ns, 'template').value;
+        }
+        this.templates[name] = element;
+    },
     eval_object:function(e, v) {
         // TODO: Currently this will also replace and, or, ... in strings. Try
         // 'hi boys and girls' != '' and 1 == 1  -- will be replaced to : 'hi boys && girls' != '' && 1 == 1
@@ -110,42 +129,45 @@
     escape_att:function(s) {
         return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
     },
-    render_node : function(e, v, inner_trim) {
-        if (e.nodeType == 3) {
-            return inner_trim ? this.trim(e.data, inner_trim) : e.data;
+    render_node : function(node, context, inner_trim) {
+        if (node.nodeType == 3) {
+            return inner_trim ? this.trim(node.data, inner_trim) : node.data;
         }
-        if (e.nodeType == 1) {
-            var g_att = {};
-            var t_att = {};
-            var t_render = null;
-            var a = e.attributes;
-            for (var i = 0; i < a.length; i++) {
-                var an = a[i].name,av = a[i].value;
-                var m;
-                if (m = an.match(this.reg)) {
-                    var n = m[1];
-                    if (n == "eval") {
-                        n = m[2].substring(1);
-                        av = this.eval_str(av, v);
-                    }
+        if (this.isElement(node)) {
+            var dom_attributes = {};
+            var qweb_attributes = {};
+            var t_render;
+            // TODO: shortcuts
+            // TODO: eval
+            var attributes = node.attributes;
+            for (var i = 0; i < attributes.length; i++) {
+                var name = attributes[i].localName,
+                   value = attributes[i].value;
+                // All attributes on {qweb}d and {qweb}directive are qweb attributes
+                // otherwise, only attributes in the qweb namespace
+                if(node.namespaceURI = this.ns
+                   || attributes[i].namespaceURI == this.ns) {
                     var f;
-                    if (f = this.att[n]) {
-                        this[f](e, t_att, g_att, v, m[2], av);
-                    } else if (f = this.tag[n]) {
+                    var split_name = name.split('-');
+                    // TODO: fix this shit
+                    if (f = this.att[split_name[0]]) {
+                        this[f](node, qweb_attributes, dom_attributes, context,
+                                split_name.slice(1).join('-'), value);
+                    } else if (f = this.tag[name]) {
                         t_render = f;
                     }
-                    t_att[n] = av;
+                    qweb_attributes[name] = value;
                 } else {
-                    g_att[an] = av;
+                    dom_attributes[name] = value;
                 }
             }
-            if (inner_trim && !t_att["trim"]) {
-                t_att["trim"] = "inner " + inner_trim;
+            if (inner_trim && !qweb_attributes["trim"]) {
+                qweb_attributes["trim"] = "inner " + inner_trim;
             }
             if (t_render) {
-                return this[t_render](e, t_att, g_att, v);
+                return this[t_render](node, qweb_attributes, dom_attributes, context);
             }
-            return this.render_element(e, t_att, g_att, v);
+            return this.render_element(node, qweb_attributes, dom_attributes, context);
         }
         return "";
     },
@@ -167,7 +189,7 @@
         if (trim && !inner_trim) {
             inner = this.trim(inner, trim);
         }
-        if (e.tagName == this.prefix) {
+        if (e.namespaceURI == this.ns) {
             return inner;
         }
         var att = "";
@@ -178,26 +200,20 @@
     },
     render_att_att:function(e, t_att, g_att, v, ext, av) {
         if (ext) {
-            g_att[ext.substring(1)] = this.eval_str(av, v);
+            g_att[ext] = this.eval_str(av, v);
         } else {
             var o = this.eval_object(av, v);
             g_att[o[0]] = o[1];
         }
     },
     render_att_attf:function(e, t_att, g_att, v, ext, av) {
-        g_att[ext.substring(1)] = this.eval_format(av, v);
+        g_att[ext] = this.eval_format(av, v);
     },
     render_tag_raw:function(e, t_att, g_att, v) {
         return this.eval_str(t_att["raw"], v);
     },
-    render_tag_rawf:function(e, t_att, g_att, v) {
-        return this.eval_format(t_att["rawf"], v);
-    },
-    render_tag_esc:function(e, t_att, g_att, v) {
-        return this.escape_text(this.eval_str(t_att["esc"], v));
-    },
-    render_tag_escf:function(e, t_att, g_att, v) {
-        return this.escape_text(this.eval_format(t_att["escf"], v));
+    render_tag_out:function(e, t_att, g_att, v) {
+        return this.escape_text(this.eval_str(t_att["out"], v));
     },
     render_tag_if:function(e, t_att, g_att, v) {
         return this.eval_bool(t_att["if"], v) ? this.render_element(e, t_att, g_att, v) : "";
@@ -381,10 +397,10 @@
                : e.childNodes ? e.childNodes
                : [];
         for (var i = 0; i < ec.length; i++) {
-            var n = ec[i];
-            if (n.nodeType == 1) {
-                var name = n.getAttribute(this.prefix + "-name");
-                this.templates[name] = n;
+            var template_candidate = ec[i];
+            if (this.isElement(template_candidate)
+                && this.isTemplate(template_candidate)) {
+                this.addTemplate(template_candidate);
             }
         }
     },


Follow ups