From 34271868761560440ab85835253f12324428f777 Mon Sep 17 00:00:00 2001 From: Ciro Scognamiglio Date: Wed, 26 Feb 2014 19:30:43 +0100 Subject: [PATCH] rest parameters can be sent also with a get --- rest/__init__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rest/__init__.py b/rest/__init__.py index c463463c..38c629b7 100644 --- a/rest/__init__.py +++ b/rest/__init__.py @@ -41,11 +41,16 @@ def dispatch(request, object_type, object_name): } if request.method == 'POST': - for el in request.POST.items(): - if el[0].startswith('filters'): - object_filters[el[0][8:-1]] = el[1] - elif el[0].startswith('columns'): - object_properties = request.POST.getlist('columns[]') + req_items = request.POST.items() + elif request.method == 'GET': + req_items = request.GET.items() + + for el in req_items: + if el[0].startswith('filters'): + object_filters[el[0][8:-1]] = el[1] + elif el[0].startswith('columns'): + object_properties = request.POST.getlist('columns[]') + # platform is local if ((object_type == 'platform') or (object_type == 'testbed')) : @@ -108,7 +113,6 @@ def send(request, response, object_properties): response_data = {} response_data['columns'] = object_properties response_data['labels'] = object_properties - #response_data['labels'] = [ 'Platform', 'Name', 'Url', 'Description','Gateway Type' ] response_data['data'] = [] response_data['total'] = len(response) for r in response : -- 2.47.0