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/25 18:59:03 UTC

[1/3] git commit: [#5501] Add contextual doc explaining valid mount points

Updated Branches:
  refs/heads/master 0cccda738 -> 8ade72f0c


[#5501] Add contextual doc explaining valid mount points

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/37c78abe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/37c78abe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/37c78abe

Branch: refs/heads/master
Commit: 37c78abeaecfb75ecc1e8b07958ee506a14cac05
Parents: 14569f1
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Apr 24 20:11:16 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Apr 25 16:58:44 2013 +0000

----------------------------------------------------------------------
 .../allura/ext/admin/templates/project_tools.html  |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/37c78abe/Allura/allura/ext/admin/templates/project_tools.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_tools.html b/Allura/allura/ext/admin/templates/project_tools.html
index c4344cb..6516039 100644
--- a/Allura/allura/ext/admin/templates/project_tools.html
+++ b/Allura/allura/ext/admin/templates/project_tools.html
@@ -50,7 +50,9 @@
     <div class="grid-13"><input type="text" name="new.mount_label" class="new_mount_label"></div>
     <label class="grid-13">Mount Point</label>
     <div class="grid-13"><input type="text" name="new.mount_point" class="new_mount_point"></div>
-    <div class="grid-13">&nbsp;</div>
+    <div class="grid-13"><small>* The mount point is the name of the tool as it will appear in a URL.
+      A valid mount point must begin with a letter, contain only letters, numbers, and dashes,
+      and be from 1-63 characters in length.</small></div>
     <hr>
     <div class="grid-13">&nbsp;</div>
     <div class="grid-13">


[2/3] git commit: [#5501] Allow 1 and 2-char mount points

Posted by jo...@apache.org.
[#5501] Allow 1 and 2-char mount points

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/14569f11
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/14569f11
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/14569f11

Branch: refs/heads/master
Commit: 14569f1187270cd0ad43ed9c8a4938d012b5ce8f
Parents: 0cccda7
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Apr 24 19:33:03 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Apr 25 16:58:44 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/helpers.py              |    2 +-
 Allura/allura/tests/model/test_project.py |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/14569f11/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index c6b144f..a941d44 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -53,7 +53,7 @@ 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]{2,}$')
+re_path_portion = 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/14569f11/Allura/allura/tests/model/test_project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_project.py b/Allura/allura/tests/model/test_project.py
index 4f14bf0..0a218b1 100644
--- a/Allura/allura/tests/model/test_project.py
+++ b/Allura/allura/tests/model/test_project.py
@@ -72,6 +72,14 @@ def test_project():
     with td.raises(ToolError):
         # mount point reserved
         c.project.install_app('Wiki', 'feed')
+    with td.raises(ToolError):
+        # mount point too long
+        c.project.install_app('Wiki', 'a' * 64)
+    with td.raises(ToolError):
+        # mount point must begin with letter
+        c.project.install_app('Wiki', '1')
+    # single letter mount points are allowed
+    c.project.install_app('Wiki', 'a')
     # Make sure the project support page is reset if the tool it was pointing
     # to is uninstalled.
     assert c.project.support_page == ''


[3/3] git commit: [#5501] Restore old regex for project names

Posted by jo...@apache.org.
[#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/master
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')