Python 3 issue in re
Python 3 interprets string literals as Unicode strings, and therefore \d is treated as an escaped Unicode character. Declare RegEx pattern as a raw string instead by prepending r or double escape \d
This commit is contained in:
parent
d84d02349c
commit
c795a70897
1 changed files with 1 additions and 1 deletions
|
|
@ -283,7 +283,7 @@ def append_number_if_name_exists(doctype, value, fieldname="name", separator="-"
|
|||
filters.update({fieldname: value})
|
||||
exists = frappe.db.exists(doctype, filters)
|
||||
|
||||
regex = "^{value}{separator}\d+$".format(value=re.escape(value), separator=separator)
|
||||
regex = "^{value}{separator}\\d+$".format(value=re.escape(value), separator=separator)
|
||||
|
||||
if exists:
|
||||
last = frappe.db.sql("""SELECT `{fieldname}` FROM `tab{doctype}`
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue