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

class Mirror(object):
    def GET(self):
        mirror_count = db.query('SELECT MIRROR,COUNT(UUID) AS HOSTS FROM HOST_MIRRORS NATURAL JOIN GENTOO_MIRRORS GROUP BY MIRROR')
        mirror_data = dict()
        for t in mirror_count:
            mirror_data[t['MIRROR']] = {'HOSTS':t['HOSTS']}
        if helpers.is_json_request():
            return helpers.serialize(mirror_data)
        else:
            return render.mirror(mirror_data)