python 3 fixes

This commit is contained in:
Rushabh Mehta 2018-02-21 17:55:51 +05:30
parent bf2936268b
commit ac93a5d4bd
4 changed files with 11 additions and 9 deletions

View file

@ -10,7 +10,7 @@ Example:
meta = frappe.get_meta('User')
if meta.has_field('first_name'):
print "DocType" table has field "first_name"
print("DocType" table has field "first_name")
'''

View file

@ -1,11 +1,12 @@
import frappe
def execute():
doc = frappe.get_single('System Settings')
doc.enable_chat = 1
frappe.reload_doctype('System Settings')
doc = frappe.get_single('System Settings')
doc.enable_chat = 1
# Changes prescribed by Nabin Hait (nabin@frappe.io)
doc.flags.ignore_mandatory = True
doc.flags.ignore_permissions = True
# Changes prescribed by Nabin Hait (nabin@frappe.io)
doc.flags.ignore_mandatory = True
doc.flags.ignore_permissions = True
doc.save()
doc.save()

View file

@ -253,7 +253,8 @@ def setup_source(page_info):
css_path = os.path.join(page_info.basepath, (page_info.basename or 'index') + '.css')
if os.path.exists(css_path):
if not '{% block style %}' in html:
css = text_type(open(css_path, 'r').read(), 'utf-8')
with io.open(css_path, 'r', encoding='utf-8') as f:
css = f.read()
html += '\n{% block style %}\n<style>\n' + css + '\n</style>\n{% endblock %}'
page_info.source = html

View file

@ -1,7 +1,7 @@
{
"name": "frappe",
"scripts": {
"build": "rollup -c",
"build": "rollup -c --silent",
"production": "FRAPPE_ENV=production rollup -c",
"watch": "rollup -c -w --silent"
},