mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
fix: invalid escape sequences in regex
This commit is contained in:
@@ -339,7 +339,7 @@ def sort_accounts(accounts, is_root=False, key="name"):
|
|||||||
"""Sort root types as Asset, Liability, Equity, Income, Expense"""
|
"""Sort root types as Asset, Liability, Equity, Income, Expense"""
|
||||||
|
|
||||||
def compare_accounts(a, b):
|
def compare_accounts(a, b):
|
||||||
if re.split('\W+', a[key])[0].isdigit():
|
if re.split(r'\W+', a[key])[0].isdigit():
|
||||||
# if chart of accounts is numbered, then sort by number
|
# if chart of accounts is numbered, then sort by number
|
||||||
return cmp(a[key], b[key])
|
return cmp(a[key], b[key])
|
||||||
elif is_root:
|
elif is_root:
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class xml2dict(object):
|
|||||||
ns = http://cs.sfsu.edu/csc867/myscheduler
|
ns = http://cs.sfsu.edu/csc867/myscheduler
|
||||||
name = patients
|
name = patients
|
||||||
"""
|
"""
|
||||||
result = re.compile("\{(.*)\}(.*)").search(tag)
|
result = re.compile(r"\{(.*)\}(.*)").search(tag)
|
||||||
if result:
|
if result:
|
||||||
value.namespace, tag = result.groups()
|
value.namespace, tag = result.groups()
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ def get_data(filters):
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Regular expression set to remove all the special characters
|
# Regular expression set to remove all the special characters
|
||||||
special_characters = "[$%^*()+\\[\]{};':\"\\|<>.?]"
|
special_characters = r"[$%^*()+\\[\]{};':\"\\|<>.?]"
|
||||||
|
|
||||||
for row in data:
|
for row in data:
|
||||||
set_defaults(row)
|
set_defaults(row)
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ def get_result_as_list(data, filters):
|
|||||||
if d.get("voucher_no").startswith("{0}-".format(JournalCode)) or d.get("voucher_no").startswith("{0}/".format(JournalCode)):
|
if d.get("voucher_no").startswith("{0}-".format(JournalCode)) or d.get("voucher_no").startswith("{0}/".format(JournalCode)):
|
||||||
EcritureNum = re.split("-|/", d.get("voucher_no"))[1]
|
EcritureNum = re.split("-|/", d.get("voucher_no"))[1]
|
||||||
else:
|
else:
|
||||||
EcritureNum = re.search("{0}(\d+)".format(JournalCode), d.get("voucher_no"), re.IGNORECASE).group(1)
|
EcritureNum = re.search(r"{0}(\d+)".format(JournalCode), d.get("voucher_no"), re.IGNORECASE).group(1)
|
||||||
|
|
||||||
EcritureDate = format_datetime(d.get("GlPostDate"), "yyyyMMdd")
|
EcritureDate = format_datetime(d.get("GlPostDate"), "yyyyMMdd")
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,8 @@ class NamingSeries(Document):
|
|||||||
options = self.scrub_options_list(ol)
|
options = self.scrub_options_list(ol)
|
||||||
|
|
||||||
# validate names
|
# validate names
|
||||||
for i in options: self.validate_series_name(i)
|
for i in options:
|
||||||
|
self.validate_series_name(i)
|
||||||
|
|
||||||
if options and self.user_must_always_select:
|
if options and self.user_must_always_select:
|
||||||
options = [''] + options
|
options = [''] + options
|
||||||
@@ -138,7 +139,7 @@ class NamingSeries(Document):
|
|||||||
|
|
||||||
def validate_series_name(self, n):
|
def validate_series_name(self, n):
|
||||||
import re
|
import re
|
||||||
if not re.match("^[\w\- /.#{}]*$", n, re.UNICODE):
|
if not re.match(r"^[\w\- \/.#{}]+$", n, re.UNICODE):
|
||||||
throw(_('Special Characters except "-", "#", ".", "/", "{" and "}" not allowed in naming series'))
|
throw(_('Special Characters except "-", "#", ".", "/", "{" and "}" not allowed in naming series'))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|||||||
Reference in New Issue
Block a user