소스 검색

PY2-PY3 compat

version-14
Achilles Rasquinha 7 년 전
부모
커밋
9790a8067a
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. +5
    -1
      frappe/core/doctype/doctype/doctype.py

+ 5
- 1
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()


불러오는 중...
취소
저장