From 62bb03ef6e30daaea34dba52adde7ab80a997ec4 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Wed, 2 Aug 2017 17:10:40 +0530 Subject: [PATCH] Replaced Python 2 print syntax with Python 3 syntax (#3838) * Replaced Python 2 print syntax with Python 3 syntax * Update utils.py --- frappe/core/doctype/user/user.py | 4 ++-- frappe/patches/v4_0/file_manager_hooks.py | 4 ++-- frappe/website/purifycss.py | 3 ++- frappe/website/utils.py | 1 - frappe/www/desk.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py index 73205f3c53..c5dfbd0e2a 100644 --- a/frappe/core/doctype/user/user.py +++ b/frappe/core/doctype/user/user.py @@ -1,7 +1,7 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt -from __future__ import unicode_literals +from __future__ import unicode_literals, print_function import frappe from frappe.model.document import Document from frappe.utils import cint, has_gravatar, format_datetime, now_datetime, get_formatted_email @@ -191,7 +191,7 @@ class User(Document): self.email_new_password(new_password) except frappe.OutgoingEmailError: - print frappe.get_traceback() + print(frappe.get_traceback()) pass # email server not set, don't send email @Document.hook diff --git a/frappe/patches/v4_0/file_manager_hooks.py b/frappe/patches/v4_0/file_manager_hooks.py index 2ebcf8ac04..60686b1e0e 100644 --- a/frappe/patches/v4_0/file_manager_hooks.py +++ b/frappe/patches/v4_0/file_manager_hooks.py @@ -1,7 +1,7 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt -from __future__ import unicode_literals +from __future__ import unicode_literals, print_function import frappe import os @@ -25,7 +25,7 @@ def execute(): _file_name, content = get_file(name) b.content_hash = get_content_hash(content) except IOError: - print 'Warning: Error processing ', name + print('Warning: Error processing ', name) _file_name = old_file_name b.content_hash = None diff --git a/frappe/website/purifycss.py b/frappe/website/purifycss.py index faf5b8b94b..d0b68d0c9b 100644 --- a/frappe/website/purifycss.py +++ b/frappe/website/purifycss.py @@ -7,6 +7,7 @@ sUpdate source and target apps below and run from CLI ''' +from __future__ import print_function import frappe, re, os source = frappe.get_app_path('frappe_theme', 'public', 'less', 'frappe_theme.less') @@ -39,4 +40,4 @@ def purifycss(): classes.remove(c) for c in sorted(classes): - print c + print(c) diff --git a/frappe/website/utils.py b/frappe/website/utils.py index efd50295f3..c4f167f2bc 100644 --- a/frappe/website/utils.py +++ b/frappe/website/utils.py @@ -302,7 +302,6 @@ def add_missing_headers(): else: fname = fname[:-3] h = fname.replace('_', ' ').replace('-', ' ').title() - print h content = '# {0}\n\n'.format(h) + content f.write(content.encode('utf-8')) diff --git a/frappe/www/desk.py b/frappe/www/desk.py index d33b45d192..ccc9577b34 100644 --- a/frappe/www/desk.py +++ b/frappe/www/desk.py @@ -1,7 +1,7 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt -from __future__ import unicode_literals +from __future__ import unicode_literals, print_function no_sitemap = 1 no_cache = 1 @@ -23,7 +23,7 @@ def get_context(context): boot = frappe.sessions.get() except Exception as e: boot = frappe._dict(status='failed', error = str(e)) - print frappe.get_traceback() + print(frappe.get_traceback()) # this needs commit csrf_token = frappe.sessions.get_csrf_token()