You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/08/21 17:27:03 UTC

[21/50] git commit: [#3154] ticket:395 created project __json__

[#3154] ticket:395 created project __json__


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

Branch: refs/heads/db/3154b
Commit: 546bfcc2ef1f540ceeaadd9722c1bf1338b02357
Parents: 2988f80
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Wed Jul 24 16:44:02 2013 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Aug 21 15:25:56 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/rest.py | 6 +-----
 Allura/allura/model/project.py    | 7 +++++++
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/546bfcc2/Allura/allura/controllers/rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/rest.py b/Allura/allura/controllers/rest.py
index 6a41be3..d1b6cb1 100644
--- a/Allura/allura/controllers/rest.py
+++ b/Allura/allura/controllers/rest.py
@@ -281,8 +281,4 @@ class ProjectRestController(object):
 
     @expose('json:')
     def index(self, **kw):
-        return dict(
-            name=c.project.shortname,
-            tools=[dict(name=t.tool_name, mount_point=t.options.mount_point, label=t.options.mount_label)
-                   for t in c.project.app_configs if h.has_access(t, 'read')]
-        )
+        return c.project.__json__()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/546bfcc2/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 02fddac..1525eec 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -837,6 +837,13 @@ class Project(MappedClass, ActivityNode, ActivityObject):
         elif os.path.exists(tmpdir):
             return 'busy'
 
+    def __json__(self):
+        return dict(
+            name=self.shortname,
+            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')]
+        )
+
 
 class AppConfig(MappedClass):
     """