allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [6/6] git commit: [#7168] ticket:569 Include neighborhood in project queries
Date Fri, 04 Apr 2014 19:57:35 GMT
[#7168] ticket:569 Include neighborhood in project queries


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

Branch: refs/heads/master
Commit: 3d45a2640b13487926b5ec0aea14f4e4130c4400
Parents: cda6608
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Wed Apr 2 14:05:44 2014 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Apr 4 19:51:24 2014 +0000

----------------------------------------------------------------------
 Allura/allura/lib/macro.py                             | 11 ++++++++++-
 ForgeGit/forgegit/tests/functional/test_controllers.py |  2 ++
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/3d45a264/Allura/allura/lib/macro.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
index 575be89..3b173fe 100644
--- a/Allura/allura/lib/macro.py
+++ b/Allura/allura/lib/macro.py
@@ -327,8 +327,17 @@ def parse_repo(repo):
     from allura import model as M
     parts = repo.split(':')
     project, app = c.project, None
+    nbhd = c.project.neighborhood if c.project else None
+    if len(parts) == 3:
+        nbhd = M.Neighborhood.query.get(url_prefix='/' + parts[0] + '/')
+        project = M.Project.query.get(
+            shortname=parts[1],
+            neighborhood_id=nbhd._id) if nbhd else None
+        app = project.app_instance(parts[2]) if project else None
     if len(parts) == 2:
-        project = M.Project.query.get(shortname=parts[0])
+        project = M.Project.query.get(
+            shortname=parts[0],
+            neighborhood_id=nbhd._id) if nbhd else None
         app = project.app_instance(parts[1]) if project else None
     elif len(parts) == 1:
         app = project.app_instance(parts[0]) if project else None

http://git-wip-us.apache.org/repos/asf/allura/blob/3d45a264/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 7c61687..47455a9 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -763,9 +763,11 @@ class TestIncludeMacro(_TestCase):
     def test_parse_repo(self):
         assert_equal(macro.parse_repo('app'), None)
         assert_equal(macro.parse_repo('proj:app'), None)
+        assert_equal(macro.parse_repo('nbhd:test:src-git'), None)
         assert_equal(macro.parse_repo('a:b:c:d:e:f'), None)
         assert_not_equal(macro.parse_repo('src-git'), None)
         assert_not_equal(macro.parse_repo('test:src-git'), None)
+        assert_not_equal(macro.parse_repo('p:test:src-git'), None)
 
     def test_include_file_no_repo(self):
         expected = '[[include repo %s (not found)]]'


Mime
View raw message