From 8f0e0fc647a1b0f825e90fd9c3c86b0fa5c9210c Mon Sep 17 00:00:00 2001 From: Achilles Rasquinha Date: Fri, 9 Feb 2018 11:03:22 +0530 Subject: [PATCH 1/3] Fixed Unicode to ASCII doc --- frappe/core/doctype/doctype/doctype.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index 5c1aa65ca4..5dc31376fc 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -381,7 +381,7 @@ class DocType(Document): # a DocType's name should not start with a number or underscore # and should only contain letters, numbers and underscore - is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w -]+$", name, re.UNICODE) + is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w -]+$", name, re.ASCII) if not is_a_valid_name: frappe.throw(_("DocType's name should start with a letter and it can only consist of letters, numbers, spaces and underscores"), frappe.NameError) From 9790a8067a87c738ca91682307e3f05418396858 Mon Sep 17 00:00:00 2001 From: Achilles Rasquinha Date: Fri, 9 Feb 2018 11:22:18 +0530 Subject: [PATCH 2/3] PY2-PY3 compat --- frappe/core/doctype/doctype/doctype.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index 5dc31376fc..4a9c7f3135 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -381,7 +381,10 @@ class DocType(Document): # a DocType's name should not start with a number or underscore # and should only contain letters, numbers and underscore - is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w -]+$", name, re.ASCII) + if six.PY2: + is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w -]+$", name) + else: + is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w -]+$", name, flags = re.ASCII) if not is_a_valid_name: frappe.throw(_("DocType's name should start with a letter and it can only consist of letters, numbers, spaces and underscores"), frappe.NameError) @@ -620,6 +623,7 @@ def validate_fields(meta): for d in fields: if not d.permlevel: d.permlevel = 0 if d.fieldtype != "Table": d.allow_bulk_edit = 0 + if d.fieldtype == "Barcode": d.ignore_xss_filter = 1 if not d.fieldname: frappe.throw(_("Fieldname is required in row {0}").format(d.idx)) d.fieldname = d.fieldname.lower() From 9743e5091ce23900a67621fbbd5ba85bd29d6910 Mon Sep 17 00:00:00 2001 From: Achilles Rasquinha Date: Fri, 9 Feb 2018 11:25:09 +0530 Subject: [PATCH 3/3] fixed import --- frappe/core/doctype/doctype/doctype.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index 4a9c7f3135..d2d8d8a621 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -3,6 +3,8 @@ from __future__ import unicode_literals +import six + import re, copy, os import frappe from frappe import _