allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject git commit: [#6391] Provide default sitemap on Application class
Date Tue, 25 Jun 2013 14:33:40 GMT
Updated Branches:
  refs/heads/tv/6391 [created] d2044d8e8


[#6391] Provide default sitemap on Application class

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@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/d2044d8e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d2044d8e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d2044d8e

Branch: refs/heads/tv/6391
Commit: d2044d8e87ef491388e837c997e5d3c0c9b364d7
Parents: e8fb5d8
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Tue Jun 25 14:32:18 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Tue Jun 25 14:32:40 2013 +0000

----------------------------------------------------------------------
 Allura/allura/app.py                  | 15 +++++++++++----
 Allura/allura/tests/unit/factories.py |  5 ++++-
 Allura/allura/tests/unit/test_app.py  |  4 ++++
 3 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d2044d8e/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 7ce847d..4599009 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -176,9 +176,6 @@ class Application(object):
         Application. Default is True.
     :cvar list permissions: Named permissions used by instances of this
         Application. Default is [].
-    :cvar list sitemap: :class:`SitemapEntries <allura.app.SitemapEntry>`
-        used to create the Application's navigation in the main project nav.
-        Default is [].
     :cvar bool installable: Default is True, Application can be installed in
         projects.
     :cvar bool hidden: Default is False, Application is not hidden from the
@@ -211,7 +208,6 @@ class Application(object):
     root = None  # root controller
     api_root = None
     permissions = []
-    sitemap = []
     installable = True
     searchable = False
     DiscussionClass = model.Discussion
@@ -244,6 +240,17 @@ class Application(object):
         self.admin = DefaultAdminController(self)
 
     @LazyProperty
+    def sitemap(self):
+        """Return a list of :class:`SitemapEntries <allura.app.SitemapEntry>`
+        describing the page hierarchy provided by this Application.
+
+        If the list is empty, the Application will not be displayed in the
+        main project nav bar.
+
+        """
+        return [SitemapEntry(self.config.options.mount_label, '.')]
+
+    @LazyProperty
     def url(self):
         """Return the URL for this Application.
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d2044d8e/Allura/allura/tests/unit/factories.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/factories.py b/Allura/allura/tests/unit/factories.py
index b4a5f1c..50f24dd 100644
--- a/Allura/allura/tests/unit/factories.py
+++ b/Allura/allura/tests/unit/factories.py
@@ -53,7 +53,10 @@ def create_app_config(project, mount_point):
     return AppConfig(
         project_id=project._id,
         tool_name='myapp',
-        options={'mount_point': 'my_mounted_app'},
+        options={
+            'mount_point': 'my_mounted_app',
+            'mount_label': 'My Mounted App',
+        },
         acl=[])
 
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d2044d8e/Allura/allura/tests/unit/test_app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_app.py b/Allura/allura/tests/unit/test_app.py
index 8f0c0db..01f4be1 100644
--- a/Allura/allura/tests/unit/test_app.py
+++ b/Allura/allura/tests/unit/test_app.py
@@ -80,6 +80,10 @@ class TestAppDefaults(WithDatabase):
     def test_that_it_denies_access_for_everything(self):
         assert not self.app.has_access(model.User.anonymous(), 'any.topic')
 
+    def test_default_sitemap(self):
+        assert self.app.sitemap[0].label == 'My Mounted App'
+        assert self.app.sitemap[0].url == '.'
+
 
 def install_app():
     project = create_project('myproject')


Mime
View raw message