Skip to content

Commit c3ab835

Browse files
committed
[REF] website, *: migrate from deprecated t-esc to t-out
*: test_website, website_* This commit updates all instances of the deprecated t-esc attribute within the website modules to use the recommended t-out attribute. The JavaScript side remains untouched. See also : odoo/design-themes#804 task-3573251
1 parent 0ac8124 commit c3ab835

File tree

58 files changed

+353
-353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+353
-353
lines changed

addons/test_website/data/test_website_data.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@
132132

133133
<!-- RECORDS FOR REDIRECT TESTS -->
134134
<template id="test_redirect_view">
135-
<t t-esc="country.name"/>
136-
<t t-if="not request.env.user._is_public()" t-esc="'Logged In'"/>
135+
<t t-out="country.name"/>
136+
<t t-if="not request.env.user._is_public()" t-out="'Logged In'"/>
137137
<!-- `href` is send through `url_for` for non editor users -->
138138
<a href="/test_website/country/andorra-1">I am a link</a>
139139
</template>

addons/website/data/website_demo.xml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,34 @@
1919
<div class="col-8">
2020
<h2>Badge</h2>
2121
<t t-foreach="bs_theme_colors" t-as="color">
22-
<span t-attf-class="badge mb-1 text-bg-#{color[0]}"><t t-esc="color[1]"/></span>
22+
<span t-attf-class="badge mb-1 text-bg-#{color[0]}"><t t-out="color[1]"/></span>
2323
</t>
2424
<h3 class="mt-2 h6">Link</h3>
2525
<t t-foreach="bs_theme_colors" t-as="color">
26-
<a href="#" t-attf-class="badge mb-1 text-bg-#{color[0]}"><t t-esc="color[1]"/></a>
26+
<a href="#" t-attf-class="badge mb-1 text-bg-#{color[0]}"><t t-out="color[1]"/></a>
2727
</t>
2828
<h3 class="mt-2 h6">Autosizing</h3>
2929
<div class="h3">
3030
<t t-foreach="bs_theme_colors" t-as="color">
31-
<span t-attf-class="badge mb-1 text-bg-#{color[0]}"><t t-esc="color[1]"/></span>
31+
<span t-attf-class="badge mb-1 text-bg-#{color[0]}"><t t-out="color[1]"/></span>
3232
</t>
3333
</div>
3434

3535
<h2 class="mt-4">Button</h2>
3636
<t t-foreach="bs_theme_colors" t-as="color">
37-
<button type="button" t-attf-class="btn mb-1 btn-#{color[0]}"><t t-esc="color[1]"/></button>
37+
<button type="button" t-attf-class="btn mb-1 btn-#{color[0]}"><t t-out="color[1]"/></button>
3838
</t>
3939
<h6 class="mt-2">Outline</h6>
4040
<t t-foreach="bs_theme_colors" t-as="color">
41-
<button type="button" t-attf-class="btn mb-1 btn-outline-#{color[0]}"><t t-esc="color[1]"/></button>
41+
<button type="button" t-attf-class="btn mb-1 btn-outline-#{color[0]}"><t t-out="color[1]"/></button>
4242
</t>
4343
<h6 class="mt-2">Small</h6>
4444
<t t-foreach="bs_theme_colors" t-as="color">
45-
<button type="button" t-attf-class="btn mb-1 btn-sm btn-#{color[0]}"><t t-esc="color[1]"/></button>
45+
<button type="button" t-attf-class="btn mb-1 btn-sm btn-#{color[0]}"><t t-out="color[1]"/></button>
4646
</t>
4747
<h6 class="mt-2">Large</h6>
4848
<t t-foreach="bs_theme_colors" t-as="color">
49-
<button type="button" t-attf-class="btn mb-1 btn-lg btn-#{color[0]}"><t t-esc="color[1]"/></button>
49+
<button type="button" t-attf-class="btn mb-1 btn-lg btn-#{color[0]}"><t t-out="color[1]"/></button>
5050
</t>
5151
<h6 class="mt-2">Group</h6>
5252
<div class="btn-group" role="group" aria-label="Basic example">
@@ -314,7 +314,7 @@
314314
<div class="col-6">
315315
<t t-foreach="bs_theme_colors" t-as="color">
316316
<div t-attf-class="alert alert-#{color[0]}">
317-
This is a "<t t-esc="color[1]"/>" alert with a <a href="#" class="alert-link">link</a>.
317+
This is a "<t t-out="color[1]"/>" alert with a <a href="#" class="alert-link">link</a>.
318318
</div>
319319
</t>
320320
</div>
@@ -363,42 +363,42 @@
363363
<div class="row g-0">
364364
<t t-foreach="odoo_theme_colors" t-as="color">
365365
<div t-attf-class="col-auto bg-#{color[0]}">
366-
<div class="py-1 px-3"><t t-esc="color[1]"/></div>
366+
<div class="py-1 px-3"><t t-out="color[1]"/></div>
367367
</div>
368368
</t>
369369
</div>
370370
<div class="row g-0 mt-2">
371371
<t t-foreach="bs_theme_colors" t-as="color">
372372
<div t-attf-class="col-auto text-bg-#{color[0]}">
373-
<div class="py-1 px-3"><t t-esc="color[1]"/></div>
373+
<div class="py-1 px-3"><t t-out="color[1]"/></div>
374374
</div>
375375
</t>
376376
</div>
377377
<div class="row g-0 mt-2">
378378
<t t-foreach="bs_gray_colors" t-as="color">
379379
<div t-attf-class="col-auto bg-#{color[0]}">
380-
<div class="py-1 px-3"><t t-esc="color[1]"/></div>
380+
<div class="py-1 px-3"><t t-out="color[1]"/></div>
381381
</div>
382382
</t>
383383
</div>
384384
<div class="row g-0 mt-4">
385385
<t t-foreach="odoo_theme_colors" t-as="color">
386386
<div t-attf-class="col-auto text-#{color[0]}">
387-
<div class="py-1 px-3"><t t-esc="color[1]"/></div>
387+
<div class="py-1 px-3"><t t-out="color[1]"/></div>
388388
</div>
389389
</t>
390390
</div>
391391
<div class="row g-0 mt-2">
392392
<t t-foreach="bs_theme_colors" t-as="color">
393393
<div t-attf-class="col-auto text-#{color[0]}">
394-
<div class="py-1 px-3"><t t-esc="color[1]"/></div>
394+
<div class="py-1 px-3"><t t-out="color[1]"/></div>
395395
</div>
396396
</t>
397397
</div>
398398
<div class="row g-0 mt-2">
399399
<t t-foreach="bs_gray_colors" t-as="color">
400400
<div t-attf-class="col-auto text-#{color[0]}">
401-
<div class="py-1 px-3"><t t-esc="color[1]"/></div>
401+
<div class="py-1 px-3"><t t-out="color[1]"/></div>
402402
</div>
403403
</t>
404404
</div>
@@ -484,7 +484,7 @@
484484
<div class="d-flex">
485485
<span t-attf-class="border p-3 me-1 bg-o-color-#{i}"></span>
486486
<div class="flex-grow-1 align-self-center">
487-
<h5 class="m-0">o-color-<t t-esc="i"/></h5>
487+
<h5 class="m-0">o-color-<t t-out="i"/></h5>
488488
</div>
489489
</div>
490490
</td>
@@ -495,7 +495,7 @@
495495
<div class="d-flex">
496496
<span t-attf-class="border p-3 me-1 bg-#{i}"></span>
497497
<div class="flex-grow-1 align-self-center">
498-
<h5 class="m-0" t-esc="i"></h5>
498+
<h5 class="m-0" t-out="i"></h5>
499499
</div>
500500
</div>
501501
</td>
@@ -510,7 +510,7 @@
510510
<div class="row">
511511
<div class="col-7">
512512
<h2>
513-
Preset <t t-esc="i"/>
513+
Preset <t t-out="i"/>
514514
</h2>
515515
<p>Paragraph text. Lorem <b>ipsum dolor sit amet</b>, consectetur adipiscing elit. <i>Integer posuere erat a ante</i>. <a href="#">Link text</a></p>
516516
<p class="text-muted">Text muted. Lorem <b>ipsum dolor sit amet</b>, consectetur.</p>
@@ -540,7 +540,7 @@
540540
<p class="card-text">Paragraph. <a href="#">text link</a></p>
541541

542542
<t t-foreach="['primary','secondary', 'info', 'warning', 'danger', 'success']" t-as="btn">
543-
<a href="#" t-attf-class="mb-2 btn-sm btn btn-#{btn}" t-esc="'btn-' + btn"/>
543+
<a href="#" t-attf-class="mb-2 btn-sm btn btn-#{btn}" t-out="'btn-' + btn"/>
544544
</t>
545545
</div>
546546
</div>
@@ -569,8 +569,8 @@
569569
</div>
570570
<div class="col-5 border-start">
571571
<div t-foreach="['info', 'warning', 'danger', 'success']" t-as="btn">
572-
<a href="#" t-attf-class="mb-2 btn-block btn btn-#{btn}" t-esc="'btn-' + btn"/>
573-
<a href="#" t-attf-class="mb-3 btn-block btn btn-outline-#{btn}" t-esc="'btn-outline-' + btn"/>
572+
<a href="#" t-attf-class="mb-2 btn-block btn btn-#{btn}" t-out="'btn-' + btn"/>
573+
<a href="#" t-attf-class="mb-3 btn-block btn btn-outline-#{btn}" t-out="'btn-outline-' + btn"/>
574574
</div>
575575
</div>
576576
</div>

addons/website/static/src/snippets/s_searchbar/000.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class="o_dropdown_menu show position-absolute w-100">
77
<t t-if="fuzzySearch and results.length">
88
<span class="dropdown-item-text">
9-
<span class="text-muted">No results found for '<t t-esc="search"/>'. Showing results for '<a href="#" class="s_searchbar_fuzzy_submit" t-esc="fuzzySearch"/>'.</span>
9+
<span class="text-muted">No results found for '<t t-out="search"/>'. Showing results for '<a href="#" class="s_searchbar_fuzzy_submit" t-out="fuzzySearch"/>'.</span>
1010
</span>
1111
</t>
1212
<t t-elif="!results.length">

addons/website/static/src/xml/website.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
<div class="modal-dialog">
66
<div class="modal-content">
77
<header class="modal-header" t-if="window_title">
8-
<h3 class="modal-title"><t t-esc="window_title"/></h3>
8+
<h3 class="modal-title"><t t-out="window_title"/></h3>
99
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
1010
</header>
1111
<main class="modal-body">
1212
<form role="form" t-att-id="id">
1313
<div class="row mb0">
1414
<label for="page-name" class="col-md-3 col-form-label">
15-
<t t-esc="field_name"/>
15+
<t t-out="field_name"/>
1616
</label>
1717
<div class="col-md-9">
1818
<input t-if="field_type == 'input'" type="text" class="form-control" required="required"/>
@@ -23,8 +23,8 @@
2323
</form>
2424
</main>
2525
<footer class="modal-footer">
26-
<button type="button" class="btn btn-primary btn-continue"><t t-esc="btn_primary_title"/></button>
27-
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-label="Cancel"><t t-esc="btn_secondary_title"/></button>
26+
<button type="button" class="btn btn-primary btn-continue"><t t-out="btn_primary_title"/></button>
27+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-label="Cancel"><t t-out="btn_secondary_title"/></button>
2828
</footer>
2929
</div>
3030
</div>

addons/website/static/src/xml/website_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<t t-name="website.s_website_form_status_error">
1313
<span id="s_website_form_result" class="me-2 small text-danger">
1414
<i class="fa fa-close me-1" role="img" aria-hidden="true" title="Error"/>
15-
<t t-esc="message"/>
15+
<t t-out="message"/>
1616
</span>
1717
</t>
1818

addons/website/static/src/xml/website_form_editor.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@
5050
</t>
5151

5252
<t t-name="website.form_label_content">
53-
<span class="s_website_form_label_content" t-esc="field.string"/>
53+
<span class="s_website_form_label_content" t-out="field.string"/>
5454
<t t-if="field.required or field.modelRequired">
55-
<span class="s_website_form_mark" t-if="field.formatInfo.requiredMark" t-esc="' ' + field.formatInfo.mark"/>
55+
<span class="s_website_form_mark" t-if="field.formatInfo.requiredMark" t-out="' ' + field.formatInfo.mark"/>
5656
</t>
5757
<t t-else="">
58-
<span class="s_website_form_mark" t-if="field.formatInfo.optionalMark" t-esc="' ' + field.formatInfo.mark"/>
58+
<span class="s_website_form_mark" t-if="field.formatInfo.optionalMark" t-out="' ' + field.formatInfo.mark"/>
5959
</t>
6060
</t>
6161

@@ -73,7 +73,7 @@
7373
not make sense to try and change it over there anyway).
7474
-->
7575
<div t-if="default_description" class="s_website_form_field_description small form-text text-muted" contenteditable="true">
76-
<t t-esc="default_description"/>
76+
<t t-out="default_description"/>
7777
</div>
7878
</t>
7979

@@ -131,7 +131,7 @@
131131
t-att-placeholder="field.placeholder"
132132
t-att-id="field.id"
133133
t-att-rows="field.rows || 3"
134-
t-esc="field.value"
134+
t-out="field.value"
135135
/>
136136
</t>
137137
</t>
@@ -266,7 +266,7 @@
266266
t-att-required="field.required || field.modelRequired || None"
267267
/>
268268
<label class="form-check-label s_website_form_check_label" t-att-for="recordId">
269-
<t t-esc="record.display_name"/>
269+
<t t-out="record.display_name"/>
270270
</label>
271271
</div>
272272
</div>
@@ -283,7 +283,7 @@
283283
<t t-call="website.form_field">
284284
<select class="form-select s_website_form_input" t-att-name="field.name" t-att-required="field.required || field.modelRequired || None" t-att-id="field.id">
285285
<t t-foreach="field.records" t-as="record" t-key="record_index">
286-
<option t-esc="record.display_name" t-att-id="field.id + record_index" t-att-value="record.id" t-att="{selected: record.selected and 'selected' or None}"/>
286+
<option t-out="record.display_name" t-att-id="field.id + record_index" t-att-value="record.id" t-att="{selected: record.selected and 'selected' or None}"/>
287287
</t>
288288
</select>
289289
</t>
@@ -335,7 +335,7 @@
335335
t-att-required="field.required || field.modelRequired || None"
336336
/>
337337
<label class="form-check-label s_website_form_check_label" t-att-for="recordId">
338-
<t t-esc="record.display_name"/>
338+
<t t-out="record.display_name"/>
339339
</label>
340340
</div>
341341
</div>

addons/website/tests/test_http_endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_can_clear_routing_map_during_render(self):
2323
'inherit_id': homepage_view.id,
2424
'arch_db': """
2525
<t t-call="website.layout" position="before">
26-
<t t-esc="website.env.registry.clear_cache('routing')"/>
26+
<t t-out="website.env.registry.clear_cache('routing')"/>
2727
</t>
2828
""",
2929
})

addons/website/tests/test_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def test_search(self):
264264
@mute_logger('odoo.http')
265265
def test_03_error_page_debug(self):
266266
with MockRequest(self.env, website=self.env['website'].browse(1)):
267-
self.base_view.arch = self.base_view.arch.replace('I am a generic page', '<t t-esc="15/0"/>')
267+
self.base_view.arch = self.base_view.arch.replace('I am a generic page', '<t t-out="15/0"/>')
268268

269269
# first call, no debug, traceback should not be visible
270270
r = self.url_open(self.page.url)

addons/website/views/snippets/s_call_to_action.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</div>
1212
<div class="col-lg-3">
1313
<p style="text-align: right;">
14-
<a t-att-href="cta_btn_href" class="btn btn-primary btn-lg"><t t-esc="cta_btn_text">Contact us</t></a>
14+
<a t-att-href="cta_btn_href" class="btn btn-primary btn-lg"><t t-out="cta_btn_text">Contact us</t></a>
1515
</p>
1616
</div>
1717
</div>

0 commit comments

Comments
 (0)