]> git.decadent.org.uk Git - dak.git/blob - dakweb/queries/archive.py
Instead of doing our own (bad) help, simply use existing epydoc foo and redirect...
[dak.git] / dakweb / queries / archive.py
1 #!/usr/bin/python
2
3 """ Archive related queries
4
5 @contact: Debian FTPMaster <ftpmaster@debian.org>
6 @copyright: 2014  Mark Hymers <mhy@debian.org>
7 @license: GNU General Public License version 2 or later
8 """
9
10 import bottle
11 import json
12
13 from daklib.dbconn import DBConn, Archive
14 from dakweb.webregister import QueryRegister
15
16
17 @bottle.route('/archives')
18 def archives():
19     """
20     Give information about all known archives (sets of suites)
21
22     @rtype: dict
23     return: list of dictionaries
24     """
25
26     s = DBConn().session()
27     q = s.query(Archive)
28     q = q.order_by(Archive.archive_name)
29     ret = []
30     for a in q:
31         ret.append({'name':      a.archive_name,
32                     'suites':    [x.suite_name for x in a.suites]})
33
34     s.close()
35
36     return json.dumps(ret)
37
38 QueryRegister().register_path('/archives', archives)