From 1798d1701bd27bc9041825b5b438be966719ee5a Mon Sep 17 00:00:00 2001 From: Valmik Jangla Date: Thu, 5 May 2016 03:50:47 -0700 Subject: [PATCH] Added validation for App title --- frappe/utils/boilerplate.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) mode change 100644 => 100755 frappe/utils/boilerplate.py diff --git a/frappe/utils/boilerplate.py b/frappe/utils/boilerplate.py old mode 100644 new mode 100755 index 1a175ce59c..e4b95732ab --- a/frappe/utils/boilerplate.py +++ b/frappe/utils/boilerplate.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals -import frappe, os +import frappe, os, re from frappe.utils import touch_file, encode, cstr def make_boilerplate(dest, app_name): @@ -17,7 +17,7 @@ def make_boilerplate(dest, app_name): hooks = frappe._dict() hooks.app_name = app_name app_title = hooks.app_name.replace("_", " ").title() - for key in ("App Title (defaut: {0})".format(app_title), + for key in ("App Title (default: {0})".format(app_title), "App Description", "App Publisher", "App Email", "App Icon (default 'octicon octicon-file-directory')", "App Color (default 'grey')", @@ -28,6 +28,9 @@ def make_boilerplate(dest, app_name): hook_val = cstr(raw_input(key + ": ")) if hook_key=="app_name" and hook_val.lower().replace(" ", "_") != hook_val: print "App Name must be all lowercase and without spaces" + hook_val = "" + elif hook_key=="app_title" and not re.match("^(?![\W])[^\d_\s][\w -]+$", hook_val, re.UNICODE): + print "App Title should start with a letter and it can only consist of letters, numbers, spaces and underscores" hook_val = "" elif not hook_val: defaults = {