summaryrefslogtreecommitdiff
path: root/addons/website/controllers/main.py
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2020-02-14 11:22:15 +0100
committerMartin Trigaux <mat@odoo.com>2020-05-14 13:59:10 +0200
commitd9287caf9408bb4ff85ad734cbca08e44321e205 (patch)
tree0d3b7c5705e5172176a7d76bf9098e381190bf4b /addons/website/controllers/main.py
parent56a8c9e4311d24c33b7ad08b8230e4be345a85b8 (diff)
[IMP] *: convert to private methods
render, render_template, load, activity_schedule_with_view, get_website_pages should all be private: It should not be possible to render an aribtrary template only with its name or id Still need to render some qweb views from js so the method render_template is kept public. This explains why the website editor still need read access on ir.ui.view as we want to allow any snippet to be rendered.
Diffstat (limited to 'addons/website/controllers/main.py')
-rw-r--r--addons/website/controllers/main.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py
index 93d44718b9b..bbbb0c5960b 100644
--- a/addons/website/controllers/main.py
+++ b/addons/website/controllers/main.py
@@ -167,15 +167,15 @@ class Website(Home):
sitemaps.unlink()
pages = 0
- locs = request.website.with_user(request.website.user_id).enumerate_pages()
+ locs = request.website.with_user(request.website.user_id)._enumerate_pages()
while True:
values = {
'locs': islice(locs, 0, LOC_PER_SITEMAP),
'url_root': request.httprequest.url_root[:-1],
}
- urls = View.render_template('website.sitemap_locs', values)
+ urls = View._render_template('website.sitemap_locs', values)
if urls.strip():
- content = View.render_template('website.sitemap_xml', {'content': urls})
+ content = View._render_template('website.sitemap_xml', {'content': urls})
pages += 1
last_sitemap = create_sitemap('/sitemap-%d-%d.xml' % (current_website.id, pages), content)
else:
@@ -194,7 +194,7 @@ class Website(Home):
pages_with_website = ["%d-%d" % (current_website.id, p) for p in range(1, pages + 1)]
# Sitemaps must be split in several smaller files with a sitemap index
- content = View.render_template('website.sitemap_index_xml', {
+ content = View._render_template('website.sitemap_index_xml', {
'pages': pages_with_website,
'url_root': request.httprequest.url_root,
})
@@ -238,7 +238,7 @@ class Website(Home):
matching_urls = set(map(lambda match: match['value'], matching_pages))
matching_last_modified = []
- last_modified_pages = current_website.get_website_pages(order='write_date desc', limit=5)
+ last_modified_pages = current_website._get_website_pages(order='write_date desc', limit=5)
for url, name in last_modified_pages.mapped(lambda p: (p.url, p.name)):
if needle.lower() in name.lower() or needle.lower() in url.lower() and url not in matching_urls:
matching_last_modified.append({
@@ -474,7 +474,7 @@ class Website(Home):
View = request.env['ir.ui.view']
res = {}
for id_or_xml_id in ids_or_xml_ids:
- res[id_or_xml_id] = View.render_template(id_or_xml_id, values)
+ res[id_or_xml_id] = View._render_template(id_or_xml_id, values)
return res
@http.route(['/website/update_visitor_timezone'], type='json', auth="public", website=True)