]> git.decadent.org.uk Git - dak.git/blobdiff - dakweb/queries/suite.py
dakweb: add sources_in_suite query
[dak.git] / dakweb / queries / suite.py
index e04c20842e585256a6273bf7651a9852450f6a4b..245b879c8ea2c677f89f90d3e2b5922644f8aac1 100644 (file)
@@ -13,7 +13,11 @@ def suites():
 
     returns: list of dictionaries
 
-    Give information about all known suites
+    Give information about all known suites.
+
+    name maps to Suite: in the release file
+    codename maps to Codename: in the release file.
+    dakname is an internal name and should not be relied upon.
     """
 
     s = DBConn().session()
@@ -21,12 +25,15 @@ def suites():
     q = q.order_by(Suite.suite_name)
     ret = []
     for p in q:
-        ret.append({'name':       p.suite_name,
+        ret.append({'name':       p.release_suite_output,
                     'codename':   p.codename,
+                    'dakname':    p.suite_name,
                     'archive':    p.archive.archive_name,
                     'architectures': [x.arch_string for x in p.architectures],
                     'components': [x.component_name for x in p.components]})
 
+    s.close()
+
     return json.dumps(ret)
 
 QueryRegister().register_path('/suites', suites)
@@ -56,6 +63,7 @@ def suite(suite=None):
 
     if q.count() > 1:
         # This would mean dak is misconfigured
+        s.close()
         return bottle.HTTPError(503, 'Multiple suites found: configuration error')
     elif q.count() == 1:
         so = q[0]
@@ -64,17 +72,21 @@ def suite(suite=None):
         q = s.query(Suite).filter(Suite.codename == suite)
         if q.count() > 1:
             # This would mean dak is misconfigured
+            s.close()
             return bottle.HTTPError(503, 'Multiple suites found: configuration error')
         elif q.count() == 1:
             so = q[0]
 
     if so is not None:
-        so = {'name':       so.suite_name,
+        so = {'name':       so.release_suite_output,
               'codename':   so.codename,
+              'dakname':    so.suite_name,
               'archive':    so.archive.archive_name,
               'architectures': [x.arch_string for x in so.architectures],
               'components': [x.component_name for x in so.components]}
 
+    s.close()
+
     return json.dumps(so)
 
 QueryRegister().register_path('/suite', suite)