You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2016/01/11 19:15:14 UTC

[1/2] allura git commit: [#7919] only show subproject as an installable tool if project is top-level (not subproject itself)

Repository: allura
Updated Branches:
  refs/heads/master 57480b6c7 -> 71c5e82b2


[#7919] only show subproject as an installable tool if project is top-level (not subproject itself)


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

Branch: refs/heads/master
Commit: bb4c5c0d83b250bd9e594e8c79a2695a10181b3d
Parents: 57480b6
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Jan 11 12:41:33 2016 -0500
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Jan 11 12:41:33 2016 -0500

----------------------------------------------------------------------
 Allura/allura/ext/admin/admin_main.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/bb4c5c0d/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index d1c04d3..45d5cc8 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -848,15 +848,17 @@ class ProjectAdminRestController(BaseController):
                 }
             })
 
-        tools.append({
-            'name': 'subproject',
-            'description': "With a Sub Project you can add an entire project just like any other tool.",
-            'tool_label': 'Sub Project',
-            'defaults': {
-                'default_mount_label': 'Sub',
-                'default_mount_point': 'sub',
-            }
-        })
+        if c.project.is_root:
+            # subprojects only allowed on top-level projects (no nesting)
+            tools.append({
+                'name': 'subproject',
+                'description': "With a Sub Project you can add an entire project just like any other tool.",
+                'tool_label': 'Sub Project',
+                'defaults': {
+                    'default_mount_label': 'Sub',
+                    'default_mount_point': 'sub',
+                }
+            })
         return {'tools': tools}
 
     @expose('json:')


[2/2] allura git commit: [#8041] JS doesn't support lookbehind assertions. And regexes don't need to be marked safe

Posted by br...@apache.org.
[#8041] JS doesn't support lookbehind assertions.  And regexes don't need to be marked safe


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

Branch: refs/heads/master
Commit: 71c5e82b21f1dc1285f2a50471351d24362b17ff
Parents: bb4c5c0
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Jan 11 13:14:34 2016 -0500
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Jan 11 13:14:34 2016 -0500

----------------------------------------------------------------------
 Allura/allura/ext/admin/templates/project_install_tool.html | 6 +++---
 Allura/allura/lib/helpers.py                                | 7 ++++---
 2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/71c5e82b/Allura/allura/ext/admin/templates/project_install_tool.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_install_tool.html b/Allura/allura/ext/admin/templates/project_install_tool.html
index 900b031..fccd193 100644
--- a/Allura/allura/ext/admin/templates/project_install_tool.html
+++ b/Allura/allura/ext/admin/templates/project_install_tool.html
@@ -22,12 +22,12 @@
 
 <h1> Installing {{ tool.tool_label }} </h1>
 {% if tool_name == 'subproject' %}
-    {% set mount_point_re = h.re_mount_points['re_project_name']|safe %}
+    {% set mount_point_re = h.re_mount_points['re_project_name'] %}
     {% set max_length = 15 %}
 {% else %}
-    {% set mount_point_re = h.re_mount_points['re_relaxed_tool_mount_point']|safe
+    {% set mount_point_re = h.re_mount_points['re_relaxed_tool_mount_point']
     if g.entry_points['tool'][tool_name].relaxed_mount_points
-    else h.re_mount_points['re_tool_mount_point']|safe %}
+    else h.re_mount_points['re_tool_mount_point'] %}
     {% set max_length = 62 %}
 {% endif %}
 

http://git-wip-us.apache.org/repos/asf/allura/blob/71c5e82b/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index c66b3f5..544b027 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -70,12 +70,13 @@ log = logging.getLogger(__name__)
 
 # http://stackoverflow.com/questions/2063213/regular-expression-for-validating-dns-label-host-name
 # modified to remove capital A-Z and make length parameterized
-dns_var_length = r'^(?![0-9]+$)(?!-)[a-z0-9-]{%s}(?<!-)$'
+# and not use lookbehind assertion since JS doesn't support that
+dns_var_length = r'^(?![0-9]+$)(?!-)[a-z0-9-]{%s}[a-z0-9]$'
 
 # project & tool names must comply to DNS since used in subdomains for emailing
 re_mount_points = {
-    're_project_name': dns_var_length % '3,15',  # validates project, subproject, and user names
-    're_tool_mount_point': dns_var_length % '1,63',  # validates tool mount point names
+    're_project_name': dns_var_length % '2,14',  # validates project, subproject, and user names
+    're_tool_mount_point': dns_var_length % '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_\.\+]*'