Merge pull request #5003 from achillesrasquinha/fixes-py3

encode utf-8 for help database
This commit is contained in:
Achilles Rasquinha 2018-02-13 18:48:48 +05:30 committed by GitHub
commit 283290e734
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,8 @@ from bs4 import BeautifulSoup
import jinja2.exceptions
from six import text_type
import io
def sync():
# make table
print('Syncing help database...')
@ -135,9 +137,9 @@ class HelpDatabase(object):
for fname in files:
if fname.rsplit('.', 1)[-1] in ('md', 'html'):
fpath = os.path.join(basepath, fname)
with open(fpath, 'r') as f:
with io.open(fpath, 'r', encoding = 'utf-8') as f:
try:
content = frappe.render_template(text_type(f.read(), 'utf-8'),
content = frappe.render_template(f.read(),
{'docs_base_url': '/assets/{app}_docs'.format(app=app)})
relpath = self.get_out_path(fpath)