From 59d33fca226689f0b8972463bf25f148bf3d7a71 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Wed, 26 Nov 2014 22:21:46 +0100 Subject: [PATCH] dakweb: add rmadison query (still incomplete) --- dakweb/dakwebserver.py | 1 + dakweb/queries/madison.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 dakweb/queries/madison.py diff --git a/dakweb/dakwebserver.py b/dakweb/dakwebserver.py index 24c729cc..6102f84b 100755 --- a/dakweb/dakwebserver.py +++ b/dakweb/dakwebserver.py @@ -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 index 00000000..469f9c80 --- /dev/null +++ b/dakweb/queries/madison.py @@ -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) -- 2.39.5