You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2014/09/17 15:33:56 UTC

[09/35] git commit: [#7659] ticket:653 Allow tools to add fields to project json API

[#7659] ticket:653 Allow tools to add fields to project json API


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

Branch: refs/heads/je/42cc_7657
Commit: 67355b5f320e46dc118fb180c83586fcc6c645e1
Parents: ef66cbb
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Sep 16 09:35:08 2014 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Sep 16 22:19:37 2014 +0000

----------------------------------------------------------------------
 Allura/allura/app.py           | 11 +++++++++++
 Allura/allura/model/project.py |  3 +--
 2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/67355b5f/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 79283a3..4fad3f4 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -641,6 +641,17 @@ class Application(object):
         ET.SubElement(feature, 'name').text = self.config.options.mount_label
         ET.SubElement(feature, 'foaf:page', {'rdf:resource': h.absurl(self.url)})
 
+    def __json__(self):
+        """App's representation for JSON API.
+
+        Returns dict that will be included in project's API under tools key.
+        """
+        return {'name': self.config.tool_name,
+                'mount_point': self.config.options.mount_point,
+                'label': self.config.options.mount_label}
+
+
+
 
 class DefaultAdminController(BaseController):
 

http://git-wip-us.apache.org/repos/asf/allura/blob/67355b5f/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index ff566c2..d8c3180 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -1090,8 +1090,7 @@ class Project(SearchIndexable, MappedClass, ActivityNode, ActivityObject):
             preferred_support_url=self.support_page_url,
             developers=[u.__json__()
                         for u in self.users_with_role('Developer')],
-            tools=[dict(name=t.tool_name, mount_point=t.options.mount_point, label=t.options.mount_label)
-                   for t in self.app_configs if h.has_access(t, 'read')],
+            tools=[self.app_instance(t) for t in self.app_configs if h.has_access(t, 'read')],
             labels=list(self.labels),
             categories={
                 n: [t.__json__(