6 from daklib.dbconn import DBConn, Suite
7 from dakweb.webregister import QueryRegister
9 @bottle.route('/suites')
14 returns: list of dictionaries
16 Give information about all known suites
19 s = DBConn().session()
21 q = q.order_by(Suite.suite_name)
24 ret.append({'name': p.suite_name,
25 'codename': p.codename,
26 'archive': p.archive.archive_name,
27 'architectures': [x.arch_string for x in p.architectures],
28 'components': [x.component_name for x in p.components]})
30 return json.dumps(ret)
32 QueryRegister().register_path('/suites', suites)
34 @bottle.route('/suite/<suite>')
35 def suite(suite=None):
41 Gives information about a single suite. Note that this routine will look
42 up a suite first by the main suite_name, but then also by codename if no
43 suite is initially found. It can therefore be used to canonicalise suite
48 return bottle.HTTPError(503, 'Suite not specified.')
50 # TODO: We should probably stick this logic into daklib/dbconn.py
53 s = DBConn().session()
55 q = q.filter(Suite.suite_name == suite)
58 # This would mean dak is misconfigured
59 return bottle.HTTPError(503, 'Multiple suites found: configuration error')
63 # Look it up by suite_name
64 q = s.query(Suite).filter(Suite.codename == suite)
66 # This would mean dak is misconfigured
67 return bottle.HTTPError(503, 'Multiple suites found: configuration error')
72 so = {'name': so.suite_name,
73 'codename': so.codename,
74 'archive': so.archive.archive_name,
75 'architectures': [x.arch_string for x in so.architectures],
76 'components': [x.component_name for x in so.components]}
80 QueryRegister().register_path('/suite', suite)