1"""Archive related queries
3@contact: Debian FTPMaster <ftpmaster@debian.org>
4@copyright: 2014 Mark Hymers <mhy@debian.org>
5@license: GNU General Public License version 2 or later
6"""
8import json
10import bottle
12from daklib.dbconn import Archive, DBConn
13from dakweb.webregister import QueryRegister
16@bottle.route("/archives")
17def archives() -> str:
18 """
19 Give information about all known archives (sets of suites)
21 :return: list of dictionaries
22 """
24 s = DBConn().session()
25 q = s.query(Archive)
26 q = q.order_by(Archive.archive_name)
27 ret = []
28 for a in q:
29 ret.append({"name": a.archive_name, "suites": [x.suite_name for x in a.suites]})
31 s.close()
33 bottle.response.content_type = "application/json; charset=UTF-8"
34 return json.dumps(ret)
37QueryRegister().register_path("/archives", archives)