allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject allura git commit: Adds convenience property for Neighborhood shortname
Date Wed, 07 Feb 2018 19:26:13 GMT
Repository: allura
Updated Branches:
  refs/heads/kt/nbhd_shortname [created] 06356760f


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

Branch: refs/heads/kt/nbhd_shortname
Commit: 06356760fad0b31024545df636204d221b6933d2
Parents: 6b6fbf5
Author: Kenton Taylor <ktaylor@slashdotmedia.com>
Authored: Wed Feb 7 19:15:33 2018 +0000
Committer: Kenton Taylor <ktaylor@slashdotmedia.com>
Committed: Wed Feb 7 19:15:33 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/06356760/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/06356760/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