]> git.donarmstrong.com Git - dak.git/blob - dakweb/queries/archive.py
Add initial suites and archives routines
[dak.git] / dakweb / queries / archive.py
1 #!/usr/bin/python
2
3 import bottle
4 import json
5
6 from daklib.dbconn import DBConn, Archive
7 from dakweb.webregister import QueryRegister
8
9 @bottle.route('/archives')
10 def archives():
11     """
12     Returns a list of supported archives
13     """
14
15     s = DBConn().session()
16     q = s.query(Archive)
17     q = q.order_by(Archive.archive_name)
18     ret = []
19     for a in q:
20         ret.append({'name':      a.archive_name,
21                     'suites':    [x.suite_name for x in a.suites]})
22
23     return json.dumps(ret)
24
25 QueryRegister().register_path('/archives', archives)
26