From: Ciro Scognamiglio Date: Wed, 26 Feb 2014 18:30:43 +0000 (+0100) Subject: rest parameters can be sent also with a get X-Git-Tag: myslice-1.1~284^2~2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=34271868761560440ab85835253f12324428f777;p=unfold.git rest parameters can be sent also with a get --- 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 :