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/05/03 23:57:34 UTC

[04/50] git commit: [#5655] Added documentation for site_stats

[#5655] Added documentation for site_stats

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

Branch: refs/heads/db/6007
Commit: 57fadd1fdf94b7dc25cd2eb029160a71459bd956
Parents: c40ddaf
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Fri Apr 26 16:31:04 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Apr 26 16:31:04 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/rest.py |   21 +++++++++++++++++++++
 Allura/docs/api/controllers.rst   |   12 ++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/57fadd1f/Allura/allura/controllers/rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/rest.py b/Allura/allura/controllers/rest.py
index 70e3ac7..c90a1ef 100644
--- a/Allura/allura/controllers/rest.py
+++ b/Allura/allura/controllers/rest.py
@@ -62,6 +62,27 @@ class RestController(object):
 
     @expose('json:')
     def index(self, **kw):
+        """Return site summary information as JSON.
+
+        Currently, the only summary information returned are any site_stats
+        whose providers are defined as entry points under the
+        'allura.site_stats' group in a package or tool's setup.py, e.g.::
+
+            [allura.site_stats]
+            new_users_24hr = allura.site_stats:new_users_24hr
+
+        The stat provider will be called with no arguments to generate the
+        stat, which will be included under a key equal to the name of the
+        entry point.
+
+        Example output::
+
+            {
+                'site_stats': {
+                    'new_users_24hr': 10
+                }
+            }
+        """
         summary = dict()
         stats = dict()
         for stat, provider in g.entry_points['site_stats'].iteritems():

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/57fadd1f/Allura/docs/api/controllers.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/controllers.rst b/Allura/docs/api/controllers.rst
new file mode 100644
index 0000000..5e56976
--- /dev/null
+++ b/Allura/docs/api/controllers.rst
@@ -0,0 +1,12 @@
+.. _controllers_module:
+
+:mod:`allura.controllers`
+--------------------------------
+
+.. automodule:: allura.controllers
+
+  .. automodule:: allura.controllers.rest
+
+    .. autoclass:: RestController
+        :members:
+