QueryRegister().register_path('/path_help', list_paths)
# Import our other methods
+from queries.archive import *
from queries.source import *
+from queries.suite import *
# Set up our initial database connection
d = DBConn()
--- /dev/null
+#!/usr/bin/python
+
+import bottle
+import json
+
+from daklib.dbconn import DBConn, Archive
+from dakweb.webregister import QueryRegister
+
+@bottle.route('/archives')
+def archives():
+ """
+ Returns a list of supported archives
+ """
+
+ s = DBConn().session()
+ q = s.query(Archive)
+ q = q.order_by(Archive.archive_name)
+ ret = []
+ for a in q:
+ ret.append({'name': a.archive_name,
+ 'suites': [x.suite_name for x in a.suites]})
+
+ return json.dumps(ret)
+
+QueryRegister().register_path('/archives', archives)
+
--- /dev/null
+#!/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)
+