aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVikraman Choudhury <vikraman.choudhury@gmail.com>2011-08-02 04:33:25 +0530
committerVikraman Choudhury <vikraman.choudhury@gmail.com>2011-08-02 04:33:25 +0530
commit11e802b2f8d6cf1e6a8f460113c6a729a306d90a (patch)
treee8f8d4f4c26fd0bd2c5f79807ecfd014485e11ab
parentadd search to gentoostats-cli (diff)
downloadgentoostats-11e802b2f8d6cf1e6a8f460113c6a729a306d90a.tar.gz
gentoostats-11e802b2f8d6cf1e6a8f460113c6a729a306d90a.tar.bz2
gentoostats-11e802b2f8d6cf1e6a8f460113c6a729a306d90a.zip
allow exporting to json from search in server
-rw-r--r--server/search.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/server/search.py b/server/search.py
index 7ddcded..d3d35d5 100644
--- a/server/search.py
+++ b/server/search.py
@@ -35,7 +35,16 @@ class Search(object):
'min_hosts':self.min_hosts,
'max_hosts':self.max_hosts})
if helpers.is_json_request():
- return helpers.serialize(search_tuples)
+ search_list = list()
+ for tuple in search_tuples:
+ search_list.append({
+ 'CAT': tuple['CAT'],
+ 'PKG': tuple['PKG'],
+ 'VER': tuple['VER'],
+ 'REPO': tuple['REPO'],
+ 'HOSTS': tuple['HOSTS']
+ })
+ return helpers.serialize(search_list)
else:
return render.search(search_tuples)