aboutsummaryrefslogtreecommitdiff
blob: 1ea1c36120ade93183ee2376a80daf3126a8e004 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import helpers
from config import render, db

class Feature(object):
    def GET(self):
        feature_count = db.query('SELECT FEATURE,COUNT(UUID) AS HOSTS FROM HOST_FEATURES NATURAL JOIN FEATURES GROUP BY FEATURE')
        feature_data = dict()
        for t in feature_count:
            feature_data[t['FEATURE']] = {'HOSTS':t['HOSTS']}
        if helpers.is_json_request():
            return helpers.serialize(feature_data)
        else:
            return render.feature(feature_data)