File: qweb-test-call.xml

package info (click to toggle)
oca-core 11.0.20180730-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 509,684 kB
  • sloc: xml: 258,806; python: 164,081; sql: 217; sh: 92; makefile: 16
file content (63 lines) | stat: -rw-r--r-- 1,868 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<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="basic-caller">
        <t t-call="_basic-callee"/>
    </t>
    <result id="basic-caller">ok</result>

    <t t-name="with-unused-body">
        <t t-call="_basic-callee">WHEEE</t>
    </t>
    <result id="with-unused-body">ok</result>

    <t t-name="with-unused-setbody">
        <t t-call="_basic-callee">
            <t t-set="qux" t-value="3"/>
        </t>
    </t>
    <result id="with-unused-setbody">ok</result>

    <t t-name="with-used-body">
        <t t-call="_callee-printsbody">ok</t>
    </t>
    <result id="with-used-body">ok</result>

    <t t-name="with-used-setbody">
        <t t-call="_callee-uses-foo">
            <t t-set="foo" t-value="'ok'"/>
        </t>
    </t>
    <result id="with-used-setbody">ok</result>

    <!--
        postfix to call removed because Python impl appends all whitespace
        following called template's root to template result (+= element.tail)
        -> ends up with bunch of extra whitespace in the middle of the
        generated content. Could normalize, not sure current impl can be
        fixed as-is
    -->
    <t t-name="inherit-context">
        <t t-set="foo" t-value="1"/>
        <t t-call="_callee-uses-foo"/><!-- - <t t-esc="foo"/> -->
    </t>
    <result id="inherit-context">1<!-- - 1 --></result>

    <t t-name="scoped-parameter">
        <t t-call="_basic-callee">
            <t t-set="foo" t-value="42"/>
        </t>
        <!-- should not print anything -->
        <t t-esc="foo"/>
    </t>
    <result id="scoped-parameter">
        ok
    </result>

    <t t-name="basic-caller">
        <t t-call="{{True and '_basic-callee' or 'other'}}"/>
    </t>
    <result id="basic-caller">ok</result>
</templates>