X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=inline;f=dakweb%2Fqueries%2Fsuite.py;fp=dakweb%2Fqueries%2Fsuite.py;h=9b37e69143f6d3f7bdcdf0c98fb5ed92b18d2d65;hb=aed7e4798d61c491c709f079645b1ad22957cdbd;hp=0000000000000000000000000000000000000000;hpb=d2f97cd3ef8b537c676dcc474ae1bd0ea3f9399c;p=dak.git diff --git a/dakweb/queries/suite.py b/dakweb/queries/suite.py new file mode 100644 index 00000000..9b37e691 --- /dev/null +++ b/dakweb/queries/suite.py @@ -0,0 +1,29 @@ +#!/usr/bin/python + +import bottle +import json + +from daklib.dbconn import DBConn, Suite +from dakweb.webregister import QueryRegister + +@bottle.route('/suites') +def suites(): + """ + Returns a list of all suites + """ + + s = DBConn().session() + q = s.query(Suite) + q = q.order_by(Suite.suite_name) + ret = [] + for p in q: + ret.append({'name': p.suite_name, + 'codename': p.codename, + 'archive': p.archive.archive_name, + 'architectures': [x.arch_string for x in p.architectures], + 'components': [x.component_name for x in p.components]}) + + return json.dumps(ret) + +QueryRegister().register_path('/suites', suites) +