From 9ff3dfcd4c60305239fc1179fa457e20554ff1d4 Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Tue, 17 Oct 2017 11:56:29 +0530 Subject: [PATCH] [hotfix] robots.txt file is considered as static instead of getting context from robots.py (#4325) --- frappe/website/render.py | 3 +-- frappe/www/robots.py | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/frappe/website/render.py b/frappe/website/render.py index fd3a27c68b..32074f6f06 100644 --- a/frappe/website/render.py +++ b/frappe/website/render.py @@ -80,7 +80,7 @@ def is_static_file(path): if ('.' not in path): return False extn = path.rsplit('.', 1)[-1] - if extn in ('html', 'md', 'js', 'xml', 'css'): + if extn in ('html', 'md', 'js', 'xml', 'css', 'txt'): return False for app in frappe.get_installed_apps(): @@ -101,7 +101,6 @@ def get_static_file_reponse(): response.mimetype = mimetypes.guess_type(frappe.flags.file_path)[0] or b'application/octet-stream' return response - def build_response(path, data, http_status_code, headers=None): # build response response = Response() diff --git a/frappe/www/robots.py b/frappe/www/robots.py index a3d67d0063..f56410be5c 100644 --- a/frappe/www/robots.py +++ b/frappe/www/robots.py @@ -4,8 +4,8 @@ no_sitemap = 1 base_template_path = "templates/www/robots.txt" def get_context(context): - robots_txt = (frappe.db.get_single_value('Website Settings', 'robots_txt') - or (frappe.local.conf.robots_txt and frappe.read_file(frappe.local.conf.robots_txt)) - or '') + robots_txt = ( + frappe.db.get_single_value('Website Settings', 'robots_txt') or + (frappe.local.conf.robots_txt and frappe.read_file(frappe.local.conf.robots_txt)) or '') return { 'robots_txt': robots_txt }