]> git.decadent.org.uk Git - dak.git/commitdiff
dakweb: Allow to query for all source packages
authorJoerg Jaspert <joerg@debian.org>
Sun, 30 Nov 2014 13:08:16 +0000 (14:08 +0100)
committerJoerg Jaspert <joerg@debian.org>
Sun, 30 Nov 2014 13:08:16 +0000 (14:08 +0100)
dakweb/queries/source.py

index 925435b132f157bc912da40fcdd07ac8e16c25eb..36344b766f1a0a14fd03f91b82bdee51b55ed212 100755 (executable)
@@ -68,3 +68,28 @@ def sources_in_suite(suite=None):
     return json.dumps(ret)
 
 QueryRegister().register_path('/sources_in_suite', sources_in_suite)
+
+
+@bottle.route('/all_sources')
+def sources_in_suite():
+    """
+    all_sources()
+
+    returns: list of dictionaries
+
+    Returns all source packages and their versions known to the archive
+    (this includes NEW).
+    """
+
+    s = DBConn().session()
+    q = s.query(DBSource)
+    ret = []
+    for p in q:
+        ret.append({'source':    p.source,
+                    'version':   p.version})
+
+    s.close()
+
+    return json.dumps(ret)
+
+QueryRegister().register_path('/all_sources', all_sources)