You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/08/26 16:00:51 UTC

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

Branch: refs/heads/tv/6595
Commit: ef74610fdc6828f721506073ee871e5a9ffadabd
Parents: d79c80b
Author: Anton Kasyanov <mi...@gmail.com>
Authored: Wed Jul 24 16:44:02 2013 +0300
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Aug 22 20:04:42 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/ef74610f/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/ef74610f/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):
     """