fixed file encoding at render js
This commit is contained in:
parent
926ccbe3dc
commit
0cc8feb17c
1 changed files with 3 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import frappe, os
|
|||
from frappe.website.utils import can_cache, delete_page_cache, extract_title
|
||||
from frappe.model.document import get_controller
|
||||
from six import text_type
|
||||
import io
|
||||
|
||||
def resolve_route(path):
|
||||
"""Returns the page route object based on searching in pages and generators.
|
||||
|
|
@ -245,7 +246,8 @@ def setup_source(page_info):
|
|||
js_path = os.path.join(page_info.basepath, (page_info.basename or 'index') + '.js')
|
||||
if os.path.exists(js_path):
|
||||
if not '{% block script %}' in html:
|
||||
js = text_type(open(js_path, 'r').read(), 'utf-8')
|
||||
with io.open(js_path, 'r', encoding = 'utf-8') as f:
|
||||
js = f.read()
|
||||
html += '\n{% block script %}<script>' + js + '\n</script>\n{% endblock %}'
|
||||
|
||||
css_path = os.path.join(page_info.basepath, (page_info.basename or 'index') + '.css')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue