incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [03/50] git commit: [#5655] Added root REST view with hook for providing site stats
Date Fri, 03 May 2013 21:57:33 GMT
[#5655] Added root REST view with hook for providing site stats

Signed-off-by: Cory Johns <cjohns@slashdotmedia.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/68a35476
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/68a35476
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/68a35476

Branch: refs/heads/db/6007
Commit: 68a354766986384384d5ab5ee30ceb10f44ab04b
Parents: c086502
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Mon Apr 22 23:29:12 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Fri Apr 26 15:33:52 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/rest.py |    9 ++++++++-
 Allura/allura/lib/app_globals.py  |    1 +
 2 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/68a35476/Allura/allura/controllers/rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/rest.py b/Allura/allura/controllers/rest.py
index e7d11f9..0d519cc 100644
--- a/Allura/allura/controllers/rest.py
+++ b/Allura/allura/controllers/rest.py
@@ -23,7 +23,7 @@ import logging
 import oauth2 as oauth
 from webob import exc
 from tg import expose, flash, redirect
-from pylons import tmpl_context as c
+from pylons import tmpl_context as c, app_globals as g
 from pylons import request
 
 from ming.orm import session
@@ -60,6 +60,13 @@ class RestController(object):
         else:
             return None
 
+    @expose('json:')
+    def index(self, **kw):
+        provider = g.entry_points['site_stats'].get('provider')
+        if provider:
+            return provider()
+        return dict()
+
     @expose()
     def _lookup(self, name, *remainder):
         api_token = self._authenticate_request()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/68a35476/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 3eb816b..e5b00c7 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -185,6 +185,7 @@ class Globals(object):
             user_prefs=_cache_eps('allura.user_prefs'),
             spam=_cache_eps('allura.spam'),
             stats=_cache_eps('allura.stats'),
+            site_stats=_cache_eps('allura.site_stats'),
             )
 
         # Zarkov logger


Mime
View raw message