allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [17/50] [abbrv] allura git commit: [#7919] Make validation patterns accessible to javascript for frontend validation
Date Fri, 08 Jan 2016 19:30:22 GMT
[#7919] Make validation patterns accessible to javascript for frontend validation


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/ab5932b0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/ab5932b0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/ab5932b0

Branch: refs/heads/master
Commit: ab5932b0f7b07a5f62497a11fb2c2c571e7e391a
Parents: c0a2803
Author: Heith Seewald <heiths@gmail.com>
Authored: Tue Dec 8 14:41:15 2015 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Fri Jan 8 14:06:15 2016 -0500

----------------------------------------------------------------------
 Allura/allura/lib/helpers.py | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/ab5932b0/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 93c0d6f..4bf92ae 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -68,16 +68,21 @@ from .security import has_access
 
 log = logging.getLogger(__name__)
 
+re_mount_points = {
+    're_project_name': r'^[a-z][-a-z0-9]{2,14}$',  # validates project, subproject, and user
names
+    're_tool_mount_point': r'^[a-z][-a-z0-9]{0,62}$',  # validates tool mount point names
+    're_tool_mount_point_fragment': r'[a-z][-a-z0-9]*',
+    're_relaxed_tool_mount_point': r'^[a-zA-Z0-9][-a-zA-Z0-9_\.\+]{0,62}$',
+    're_relaxed_tool_mount_point_fragment':  r'[a-zA-Z0-9][-a-zA-Z0-9_\.\+]*'
+}
 # validates project, subproject, and user names
-re_project_name = re.compile(r'^[a-z][-a-z0-9]{2,14}$')
+re_project_name = re.compile(re_mount_points['re_project_name'])
 
 # validates tool mount point names
-re_tool_mount_point = re.compile(r'^[a-z][-a-z0-9]{0,62}$')
-re_tool_mount_point_fragment = re.compile(r'[a-z][-a-z0-9]*')
-re_relaxed_tool_mount_point = re.compile(
-    r'^[a-zA-Z0-9][-a-zA-Z0-9_\.\+]{0,62}$')
-re_relaxed_tool_mount_point_fragment = re.compile(
-    r'[a-zA-Z0-9][-a-zA-Z0-9_\.\+]*')
+re_tool_mount_point = re.compile(re_mount_points['re_tool_mount_point'])
+re_tool_mount_point_fragment = re.compile(re_mount_points['re_tool_mount_point_fragment'])
+re_relaxed_tool_mount_point = re.compile(re_mount_points['re_relaxed_tool_mount_point'])
+re_relaxed_tool_mount_point_fragment = re.compile(re_mount_points['re_relaxed_tool_mount_point_fragment'])
 
 re_clean_vardec_key = re.compile(r'''\A
 ( # first part


Mime
View raw message