浏览代码

Merge pull request #4990 from achillesrasquinha/hf-ascii-doc

Fixed Unicode to ASCII doc
version-14
Achilles Rasquinha 7 年前
committed by GitHub
父节点
当前提交
753fa56b7a
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. +7
    -1
      frappe/core/doctype/doctype/doctype.py

+ 7
- 1
frappe/core/doctype/doctype/doctype.py 查看文件

@@ -3,6 +3,8 @@


from __future__ import unicode_literals from __future__ import unicode_literals


import six

import re, copy, os import re, copy, os
import frappe import frappe
from frappe import _ from frappe import _
@@ -381,7 +383,10 @@ class DocType(Document):


# a DocType's name should not start with a number or underscore # a DocType's name should not start with a number or underscore
# and should only contain letters, numbers and underscore # and should only contain letters, numbers and underscore
is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w -]+$", name, re.UNICODE)
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: 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) 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 +625,7 @@ def validate_fields(meta):
for d in fields: for d in fields:
if not d.permlevel: d.permlevel = 0 if not d.permlevel: d.permlevel = 0
if d.fieldtype != "Table": d.allow_bulk_edit = 0 if d.fieldtype != "Table": d.allow_bulk_edit = 0
if d.fieldtype == "Barcode": d.ignore_xss_filter = 1
if not d.fieldname: if not d.fieldname:
frappe.throw(_("Fieldname is required in row {0}").format(d.idx)) frappe.throw(_("Fieldname is required in row {0}").format(d.idx))
d.fieldname = d.fieldname.lower() d.fieldname = d.fieldname.lower()


正在加载...
取消
保存