diff options
author | Vikraman Choudhury <vikraman.choudhury@gmail.com> | 2011-08-02 04:44:44 +0530 |
---|---|---|
committer | Vikraman Choudhury <vikraman.choudhury@gmail.com> | 2011-08-02 04:44:44 +0530 |
commit | ce8c56f9018af95fb2a2918d9c4ed3f647871070 (patch) | |
tree | a094ba1c28dfcea9c3e94ab68239914fb1a2cdf3 | |
parent | remove debugging print from search.py (diff) | |
download | gentoostats-ce8c56f9018af95fb2a2918d9c4ed3f647871070.tar.gz gentoostats-ce8c56f9018af95fb2a2918d9c4ed3f647871070.tar.bz2 gentoostats-ce8c56f9018af95fb2a2918d9c4ed3f647871070.zip |
export use data to json
-rw-r--r-- | 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() |