allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject allura git commit: Adds convenience property for Neighborhood shortname
Date Fri, 09 Feb 2018 16:29:00 GMT
Repository: allura
Updated Branches:
  refs/heads/master d9a4fc1ec -> b87747c84


Adds convenience property for Neighborhood shortname


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

Branch: refs/heads/master
Commit: b87747c846e16def4e9f5221ba3534fef78bb0ac
Parents: d9a4fc1
Author: Kenton Taylor <ktaylor@slashdotmedia.com>
Authored: Wed Feb 7 19:15:33 2018 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri Feb 9 16:27:15 2018 +0000

----------------------------------------------------------------------
 Allura/allura/model/neighborhood.py            | 4 ++++
 Allura/allura/tests/model/test_neighborhood.py | 3 +++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/b87747c8/Allura/allura/model/neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/neighborhood.py b/Allura/allura/model/neighborhood.py
index 1c7ff9e..59b9075 100644
--- a/Allura/allura/model/neighborhood.py
+++ b/Allura/allura/model/neighborhood.py
@@ -108,6 +108,10 @@ class Neighborhood(MappedClass):
     def acl(self):
         return self.neighborhood_project.acl
 
+    @property
+    def shortname(self):
+        return self.url_prefix.strip('/')
+
     def url(self):
         url = self.url_prefix
         if url.startswith('//'):

http://git-wip-us.apache.org/repos/asf/allura/blob/b87747c8/Allura/allura/tests/model/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_neighborhood.py b/Allura/allura/tests/model/test_neighborhood.py
index ae0f1dd..b1ba8c3 100644
--- a/Allura/allura/tests/model/test_neighborhood.py
+++ b/Allura/allura/tests/model/test_neighborhood.py
@@ -86,3 +86,6 @@ def test_neighborhood():
 
     neighborhood.prohibited_tools = 'wiki, tickets'
     assert neighborhood.get_prohibited_tools() == ['wiki', 'tickets']
+
+    # Check properties
+    assert neighborhood.shortname == "p"


Mime
View raw message