You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/04/26 16:53:10 UTC
[06/12] git commit: [#5501] Restore old regex for project names
[#5501] Restore old regex for project names
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8ade72f0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8ade72f0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8ade72f0
Branch: refs/heads/cj/5655
Commit: 8ade72f0c6049e284e0a927b55a791f4b9735134
Parents: 37c78ab
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Apr 25 14:11:25 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Apr 25 16:58:45 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/project.py | 6 ++++--
Allura/allura/lib/helpers.py | 3 ++-
Allura/allura/model/project.py | 2 +-
.../allura/tests/functional/test_neighborhood.py | 7 +++----
4 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ade72f0/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index 11ef3e3..2f59a38 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -583,14 +583,16 @@ class NeighborhoodAdminController(object):
result = True
if anchored_tools.strip() != '':
try:
- validate_tools = dict((tool.split(':')[0].lower(), tool.split(':')[1]) for tool in anchored_tools.replace(' ', '').split(','))
+ validate_tools = dict(
+ (tool.split(':')[0].lower(), tool.split(':')[1])
+ for tool in anchored_tools.replace(' ', '').split(','))
except Exception:
flash('Anchored tools "%s" is invalid' % anchored_tools,'error')
result = False
for tool in validate_tools.keys():
- if not h.re_path_portion.match(tool):
+ if not h.re_tool_mount_point.match(tool):
flash('Anchored tools "%s" is invalid' % anchored_tools,'error')
result = False
if result:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ade72f0/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index a941d44..ea2b4d2 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -53,7 +53,8 @@ from allura.lib import AsciiDammit
from .security import has_access
re_path_portion_fragment = re.compile(r'[a-z][-a-z0-9]*')
-re_path_portion = re.compile(r'^[a-z][-a-z0-9]{0,62}$')
+re_path_portion = re.compile(r'^[a-z][-a-z0-9]{2,}$')
+re_tool_mount_point = re.compile(r'^[a-z][-a-z0-9]{0,62}$')
re_clean_vardec_key = re.compile(r'''\A
( # first part
\w+# name...
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ade72f0/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 137e98b..d207aab 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -547,7 +547,7 @@ class Project(MappedClass, ActivityNode, ActivityObject):
for x in range(10):
if self.app_instance(mount_point) is None: break
mount_point = base_mount_point + '-%d' % x
- if not h.re_path_portion.match(mount_point):
+ if not h.re_tool_mount_point.match(mount_point):
raise exceptions.ToolError, 'Mount point "%s" is invalid' % mount_point
# HACK: reserved url components
if mount_point in ('feed', 'index', 'icon', '_nav.json'):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ade72f0/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index 41c7121..f91b5cb 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -741,10 +741,9 @@ class TestNeighborhood(TestController):
assert_equal(r.json, dict(suggested_name='test'))
def test_name_check(self):
- r = self.app.get('/p/check_names?unix_name=My+Moz')
- assert r.json['unixname_message'] == 'Please use only letters, numbers, and dashes 3-15 characters long.'
- r = self.app.get('/p/check_names?unix_name=Te%st!')
- assert r.json['unixname_message'] == 'Please use only letters, numbers, and dashes 3-15 characters long.'
+ for name in ('My+Moz', 'Te%st!', 'ab', 'a' * 16):
+ r = self.app.get('/p/check_names?unix_name=%s' % name)
+ assert r.json['unixname_message'] == 'Please use only letters, numbers, and dashes 3-15 characters long.'
r = self.app.get('/p/check_names?unix_name=mymoz')
assert_equal(r.json['unixname_message'], False)
r = self.app.get('/p/check_names?unix_name=test')