refactor: Use build_response in WebPage class

This commit is contained in:
Suraj Shetty 2021-06-24 18:01:09 +05:30
parent 57e41230b8
commit e8d41c945c
2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
import frappe
from frappe.model.document import get_controller
from frappe.website.page_renderers.base_template_page import BaseTemplatePage
from frappe.website.utils import build_response, cache_html
from frappe.website.utils import cache_html
from frappe.website.router import (get_doctypes_with_web_view,
get_page_info_from_web_page_with_dynamic_routes)
@ -50,7 +50,7 @@ class DocumentPage(BaseTemplatePage):
html = self.get_html()
html = self.add_csrf_token(html)
return build_response(self.path, html, self.http_status_code or 200, self.headers)
return self.build_response(html)
@cache_html
def get_html(self):

View file

@ -7,7 +7,7 @@ from frappe.website.router import get_page_info
from frappe.website.page_renderers.base_template_page import BaseTemplatePage
from frappe.website.router import get_base_template
from frappe.website.utils import (extract_comment_tag, extract_title, get_next_link,
get_toc, get_frontmatter, cache_html, get_sidebar_items, build_response)
get_toc, get_frontmatter, cache_html, get_sidebar_items)
WEBPAGE_PY_MODULE_PROPERTIES = ("base_template_path", "template", "no_cache", "sitemap", "condition_field")
@ -60,7 +60,7 @@ class TemplatePage(BaseTemplatePage):
def render(self):
html = self.get_html()
html = self.add_csrf_token(html)
return build_response(self.path, html, self.http_status_code, self.headers)
return self.build_response(html)
@cache_html
def get_html(self):