diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2015-01-27 18:29:18 +0100 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2015-01-27 18:29:18 +0100 |
commit | 303ba143ae9127491c2bd632209f9bfb406a89c6 (patch) | |
tree | 15f3107fd8bbda5c14f261834c1a9a08c00f519b | |
parent | 642aa230d871a1e216ae9563fdcf62005d5f8ad3 (diff) |
Fix call to backend bisect.
Change-Id: Idd007d21151dd11e5f61fdf2cb3e52aa287dbb3d
-rw-r--r-- | app/dashboard/__init__.py | 19 | ||||
-rw-r--r-- | app/dashboard/utils/backend.py | 16 |
2 files changed, 20 insertions, 15 deletions
diff --git a/app/dashboard/__init__.py b/app/dashboard/__init__.py index 3483896..378b30d 100644 --- a/app/dashboard/__init__.py +++ b/app/dashboard/__init__.py @@ -188,18 +188,17 @@ def ajax_batch(): abort(400) -@app.route("/_ajax/bisect/<string:collection>/<string:doc_id>") -def ajax_bisect_call(collection=None, doc_id=None): +@app.route("/_ajax/bisect") +@app.route("/_ajax/bisect/<string:doc_id>") +def ajax_bisect_call(doc_id=None): if validate_csrf(request.headers.get(CSRF_TOKEN_H, None)): # Cache bisect data for 2 hours. - if all([collection, doc_id]): - return backend.ajax_bisect( - request, collection, doc_id, - app_conf_get("BISECT_API_ENDPOINT"), - timeout=60*60*2 - ) - else: - abort(400) + return backend.ajax_bisect( + request, + doc_id, + app_conf_get("BISECT_API_ENDPOINT"), + timeout=60*60*2 + ) else: abort(400) diff --git a/app/dashboard/utils/backend.py b/app/dashboard/utils/backend.py index 95bc75e..7aedfd3 100644 --- a/app/dashboard/utils/backend.py +++ b/app/dashboard/utils/backend.py @@ -366,18 +366,24 @@ def ajax_get(request, api_path, timeout=None): return (data, status_code, headers.items()) -def ajax_bisect(request, collection, doc_id, api_path, timeout=None): +def ajax_bisect(request, doc_id, api_path, timeout=None): """Handle GET operations on the bisect collection. :param request: The request performed. - :param collection: The name of the collection where to perform the bisect. - :param doc_id: The ID of the document to bisect. + :param doc_id: The ID of the bisect document. :param api_path: The API endpoint where to perform the request. """ - api_path = _create_api_path(api_path, [collection, doc_id]) + params_list = request.args.lists() + + if doc_id: + api_path = _create_api_path(api_path, [doc_id]) + else: + api_path = _create_api_path(api_path) url = _create_url(api_path) + print url - data, status_code, headers = request_get(url, timeout=timeout) + data, status_code, headers = request_get( + url, params=params_list, timeout=timeout) return (data, status_code, headers.items()) |