Browse Source

fix: trailing spaces match only when re compile

version-14
hasnain2808@gmail.com 4 years ago
parent
commit
521968e72b
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      frappe/core/doctype/doctype/doctype.py

+ 2
- 1
frappe/core/doctype/doctype/doctype.py View File

@@ -669,7 +669,8 @@ class DocType(Document):
flags = {"flags": re.ASCII} if six.PY3 else {}

# a DocType name should not start or end with an empty space
if re.match("^[ \t\n\r]+|[ \t\n\r]+$", name, **flags):
lead_trail_whitespace_re = re.compile("^[ \t\n\r]+|[ \t\n\r]+$", **flags)
if lead_trail_whitespace_re.findall(name):
frappe.throw(_("DocType's name should not start or end with whitespace"), frappe.NameError)

# a DocType's name should not start with a number or underscore


Loading…
Cancel
Save