X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=rest%2Fupdate.py;h=cb11668346d4ff633effee6062c4cc03eba10535;hb=a4f494123a2924f970d9702180949a1058534311;hp=965797642f9d55bcd5fcde38814b5d7d1b1ff1eb;hpb=fecbbac04ddd2f55989661f4666dcabae647dc50;p=myslice.git diff --git a/rest/update.py b/rest/update.py index 96579764..cb116683 100644 --- a/rest/update.py +++ b/rest/update.py @@ -23,16 +23,34 @@ def dispatch(request, object_type, object_name): elif request.method == 'GET': #return error('only post request is supported') req_items = request.GET + print req_items for el in req_items.items(): + + print "#===============>",el if el[0].startswith('filters'): o.filters[el[0][8:-1]] = el[1] elif el[0].startswith('params'): - o.params[el[0][7:-1]] = el[1] + print "#======> 0 ", el[0] + #print "#======>", el[0][7:8] + #print "#======>", el[0][10:-1] + print "#======> 1 ", el[1] + #o.params = req_items.getlist('params[]') + #o.params.append({el[0]:el[1]}) + + #params[key][] + if (el[0][-2:-1] == '[]') : + o.params.append({el[0][7:-3]:",".join(el[1])}) + else : + #params[key] + o.params.append({el[0][7:-1]:el[1]}) + + print "o.params = ",o.params + elif el[0].startswith('fields'): o.fields=req_items.getlist('fields[]') elif el[0].startswith('options'): o.options = req_items.getlist('options[]') - + try: response = o.update() @@ -42,5 +60,5 @@ def dispatch(request, object_type, object_name): return error('an error has occurred') except Exception, e: - return error(str(e)) + return error("exception:"+str(e))