allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject git commit: [#7659] ticket:653 Allow tools to add fields to project json API
Date Tue, 16 Sep 2014 08:40:20 GMT
Repository: allura
Updated Branches:
  refs/heads/je/42cc_7659 [created] 22fb7ca57


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

Branch: refs/heads/je/42cc_7659
Commit: 22fb7ca57d226a9951d668cdd27855803d59f69a
Parents: fab7d22
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Tue Sep 16 09:35:08 2014 +0300
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Tue Sep 16 09:35:08 2014 +0300

----------------------------------------------------------------------
 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/22fb7ca5/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/22fb7ca5/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__(


Mime
View raw message