You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/12/11 23:09:32 UTC

git commit: [#6971] Allow tasks to be created for user projects

Updated Branches:
  refs/heads/tv/6971 [created] 7fbf93c9b


[#6971] Allow tasks to be created for user projects

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

Branch: refs/heads/tv/6971
Commit: 7fbf93c9b95ced4c27f785caa3ce32f8dab7306d
Parents: fcf2e46
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Dec 11 22:09:18 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Dec 11 22:09:18 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/validators.py        | 3 ++-
 Allura/allura/tests/test_validators.py | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7fbf93c9/Allura/allura/lib/validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index 3295bb0..3556fe0 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -152,7 +152,8 @@ class PathValidator(fev.FancyValidator):
         if not nbhd:
             raise fe.Invalid('Invalid neighborhood: %s' % nbhd_url_prefix, value, state)
 
-        project = M.Project.query.get(shortname=project_name, neighborhood_id=nbhd._id)
+        project = M.Project.query.get(shortname=nbhd.shortname_prefix + project_name,
+                neighborhood_id=nbhd._id)
         if not project:
             raise fe.Invalid('Invalid project: %s' % project_name, value, state)
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7fbf93c9/Allura/allura/tests/test_validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_validators.py b/Allura/allura/tests/test_validators.py
index 26779ce..f3ba1ee 100644
--- a/Allura/allura/tests/test_validators.py
+++ b/Allura/allura/tests/test_validators.py
@@ -23,6 +23,7 @@ from allura import model as M
 from allura.lib import validators as v
 from allura.lib.decorators import task
 from alluratest.controller import setup_basic_test
+from allura.websetup.bootstrap import create_user
 
 
 def setUp():
@@ -189,6 +190,13 @@ class TestPathValidator(unittest.TestCase):
         self.assertEqual(d['project'], project)
         self.assertTrue('app' not in d)
 
+    def test_project_in_nbhd_with_prefix(self):
+        create_user('myuser', make_project=True)
+        project = M.Project.query.get(shortname='u/myuser')
+        d = self.val.to_python('/u/myuser')
+        self.assertEqual(d['project'], project)
+        self.assertTrue('app' not in d)
+
     def test_valid_app(self):
         project = M.Project.query.get(shortname='test')
         app = project.app_instance('admin')