Merge branch 'develop'
This commit is contained in:
commit
d2ca264689
7 changed files with 30 additions and 9 deletions
|
|
@ -1,2 +1,2 @@
|
|||
from __future__ import unicode_literals
|
||||
__version__ = "6.23.2"
|
||||
__version__ = "6.23.3"
|
||||
|
|
|
|||
|
|
@ -237,8 +237,9 @@ class DocType(Document):
|
|||
|
||||
# a DocType's name should not start with a number or underscore
|
||||
# and should only contain letters, numbers and underscore
|
||||
if not re.match("^(?![\W])[^\d_][\w]+$", name, re.UNICODE):
|
||||
frappe.throw(_("DocType's name should start with a letter and it can only consist of letters, numbers and underscores"))
|
||||
is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w ]+$", name, re.UNICODE)
|
||||
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)
|
||||
|
||||
def validate_fields_for_doctype(doctype):
|
||||
validate_fields(frappe.get_meta(doctype, cached=False))
|
||||
|
|
|
|||
|
|
@ -9,4 +9,23 @@ import unittest
|
|||
# test_records = frappe.get_test_records('DocType')
|
||||
|
||||
class TestDocType(unittest.TestCase):
|
||||
pass
|
||||
def new_doctype(self, name):
|
||||
return frappe.get_doc({
|
||||
"doctype": "DocType",
|
||||
"module": "Core",
|
||||
"custom": 1,
|
||||
"fields": [{"label": "Some Field", "fieldname": "some_fieldname", "fieldtype": "Data"}],
|
||||
"permissions": [{"role": "System Manager", "read": 1}],
|
||||
"name": name
|
||||
})
|
||||
|
||||
def test_validate_name(self):
|
||||
self.assertRaises(frappe.NameError, self.new_doctype("_Some DocType").insert)
|
||||
self.assertRaises(frappe.NameError, self.new_doctype("8Some DocType").insert)
|
||||
self.assertRaises(frappe.NameError, self.new_doctype("Some (DocType)").insert)
|
||||
for name in ("Some DocType", "Some_DocType"):
|
||||
if frappe.db.exists("DocType", name):
|
||||
frappe.delete_doc("DocType", name)
|
||||
|
||||
doc = self.new_doctype(name).insert()
|
||||
doc.delete()
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd."
|
|||
app_description = "Full stack web framework with Python, Javascript, MariaDB, Redis, Node"
|
||||
|
||||
app_icon = "octicon octicon-circuit-board"
|
||||
app_version = "6.23.2"
|
||||
app_version = "6.23.3"
|
||||
app_color = "orange"
|
||||
source_link = "https://github.com/frappe/frappe"
|
||||
app_license = "MIT"
|
||||
|
|
|
|||
|
|
@ -185,8 +185,8 @@ def collect_error_snapshots():
|
|||
|
||||
def clear_old_snapshots():
|
||||
"""Clear snapshots that are older than a month"""
|
||||
frappe.delete_doc("Error Snapshot", frappe.db.sql_list("""select name from `tabError Snapshot`
|
||||
where creation < date_sub(now(), interval 1 month) order by creation desc"""))
|
||||
frappe.db.sql("""delete from `tabError Snapshot`
|
||||
where creation < date_sub(now(), interval 1 month)""")
|
||||
|
||||
path = get_error_snapshot_path()
|
||||
today = datetime.datetime.now()
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ def sync_fixtures(app=None):
|
|||
apps = frappe.get_installed_apps()
|
||||
for app in apps:
|
||||
if os.path.exists(frappe.get_app_path(app, "fixtures")):
|
||||
for fname in os.listdir(frappe.get_app_path(app, "fixtures")):
|
||||
fixture_files = sorted(os.listdir(frappe.get_app_path(app, "fixtures")))
|
||||
for fname in fixture_files:
|
||||
if fname.endswith(".json") or fname.endswith(".csv"):
|
||||
import_doc(frappe.get_app_path(app, "fixtures", fname), ignore_links=True, overwrite=True)
|
||||
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -1,7 +1,7 @@
|
|||
from setuptools import setup, find_packages
|
||||
from pip.req import parse_requirements
|
||||
|
||||
version = "6.23.2"
|
||||
version = "6.23.3"
|
||||
requirements = parse_requirements("requirements.txt", session="")
|
||||
|
||||
setup(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue