]> git.decadent.org.uk Git - dak.git/commitdiff
dakweb: add rmadison query (still incomplete)
authorAnsgar Burchardt <ansgar@debian.org>
Wed, 26 Nov 2014 21:21:46 +0000 (22:21 +0100)
committerAnsgar Burchardt <ansgar@debian.org>
Wed, 26 Nov 2014 21:22:04 +0000 (22:22 +0100)
dakweb/dakwebserver.py
dakweb/queries/madison.py [new file with mode: 0644]

index 24c729cc6f7a0d33b489f9fa9b98d5f46f9239b2..6102f84bd5d324657298cefe9cd9453c7a4a78cd 100755 (executable)
@@ -33,6 +33,7 @@ QueryRegister().register_path('/path_help', list_paths)
 
 # Import our other methods
 from queries.archive import *
+from queries.madison import *
 from queries.source import *
 from queries.suite import *
 
diff --git a/dakweb/queries/madison.py b/dakweb/queries/madison.py
new file mode 100644 (file)
index 0000000..469f9c8
--- /dev/null
@@ -0,0 +1,31 @@
+import bottle
+import json
+
+from daklib.ls import list_packages
+from dakweb.webregister import QueryRegister
+
+@bottle.route('/madison')
+def madison():
+    r = bottle.request
+
+    packages = r.query.get('package', '').split()
+    kwargs = dict()
+
+    binary_type = r.query.get('b', None)
+    if binary_type is not None:
+        kwargs['binary_types'] = [binary_type]
+    component = r.query.get('c', None)
+    if component is not None:
+        kwargs['components'] = component.split(",")
+    suite = r.query.get('s', None)
+    if suite is not None:
+        kwargs['suites'] = suite.split(",")
+    if 'S' in r.query:
+        kwargs['source_and_binary'] = True
+    #if 'r' in r.query:
+    #    kwargs['regex'] = True
+
+    result = list_packages(packages, **kwargs)
+    return "\n".join(result) + "\n"
+
+QueryRegister().register_path('/madison', madison)