Package dakweb :: Package queries :: Module archive
[hide private]
[frames] | no frames]

Source Code for Module dakweb.queries.archive

 1  """ Archive related queries 
 2   
 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  """ 
 7   
 8  import bottle 
 9  import json 
10   
11  from daklib.dbconn import DBConn, Archive 
12  from dakweb.webregister import QueryRegister 
13 14 15 @bottle.route('/archives') 16 -def archives():
17 """ 18 Give information about all known archives (sets of suites) 19 20 @rtype: dict 21 return: list of dictionaries 22 """ 23 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, 30 'suites': [x.suite_name for x in a.suites]}) 31 32 s.close() 33 34 bottle.response.content_type = 'application/json; charset=UTF-8' 35 return json.dumps(ret)
36 37 38 QueryRegister().register_path('/archives', archives) 39