[hotfix] robots.txt file is considered as static instead of getting context from robots.py (#4325)

This commit is contained in:
Makarand Bauskar 2017-10-17 11:56:29 +05:30 committed by Rushabh Mehta
parent fe75ffb8da
commit 9ff3dfcd4c
2 changed files with 4 additions and 5 deletions

View file

@ -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()

View file

@ -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 }