public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Vikraman Choudhury" <vikraman.choudhury@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoostats:master commit in: server/
Date: Mon,  1 Aug 2011 23:15:04 +0000 (UTC)	[thread overview]
Message-ID: <ce8c56f9018af95fb2a2918d9c4ed3f647871070.vikraman@gentoo> (raw)

commit:     ce8c56f9018af95fb2a2918d9c4ed3f647871070
Author:     Vikraman Choudhury <vikraman.choudhury <AT> gmail <DOT> com>
AuthorDate: Mon Aug  1 23:14:44 2011 +0000
Commit:     Vikraman Choudhury <vikraman.choudhury <AT> gmail <DOT> com>
CommitDate: Mon Aug  1 23:14:44 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoostats.git;a=commit;h=ce8c56f9

export use data to json

---
 server/use.py |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/server/use.py b/server/use.py
index 13068ec..4318ee8 100644
--- a/server/use.py
+++ b/server/use.py
@@ -1,4 +1,5 @@
 
+import helpers
 from config import render, db
 
 class Use(object):
@@ -8,7 +9,10 @@ class Use(object):
             use_query = db.query('SELECT COUNT(DISTINCT UKEY) AS USE_COUNT FROM USEFLAGS')
             use_tuple = use_query[0]
             use_data = {'USE_COUNT':use_tuple['USE_COUNT']}
-            return render.use(use_data)
+            if helpers.is_json_request():
+                return helpers.serialize(use_data)
+            else:
+                return render.use(use_data)
 
         elif l == 1:
             global_use_query = db.query('SELECT COUNT(DISTINCT UUID) AS GLOBAL_COUNT\
@@ -39,8 +43,10 @@ class Use(object):
                     'MINUS_COUNT':minus_use_tuple['MINUS_COUNT'],
                     'UNSET_COUNT':unset_use_tuple['UNSET_COUNT']
                     }
-
-            return render.use_useflag(args[0], use_data)
+            if helpers.is_json_request():
+                return helpers.serialize(use_data)
+            else:
+                return render.use_useflag(args[0], use_data)
 
         else:
             return config.internalerror()



             reply	other threads:[~2011-08-01 23:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01 23:15 Vikraman Choudhury [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-06 20:04 [gentoo-commits] proj/gentoostats:master commit in: server/ Vikraman Choudhury
2011-08-01 23:40 Vikraman Choudhury
2011-08-01 23:04 Vikraman Choudhury
2011-07-25 12:35 Vikraman Choudhury
2011-07-11  8:26 Vikraman Choudhury
2011-06-30 10:28 Vikraman Choudhury
2011-06-15 20:55 Vikraman Choudhury
2011-05-11 23:52 Vikraman Choudhury
2011-05-11 22:42 Vikraman Choudhury

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce8c56f9018af95fb2a2918d9c4ed3f647871070.vikraman@gentoo \
    --to=vikraman.choudhury@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox