X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=engine%2Fmanifoldquery.py;h=332309b2f3d1e715a240b1092d3f9e26f91537bd;hb=6ee5cf51bf467560e4566b2b7bfa8e22dfff0784;hp=47b261f4434205a203af756a59dab31ad0aa2183;hpb=129d3dac66455410b60162594d8b3387ff4e0203;p=unfold.git diff --git a/engine/manifoldquery.py b/engine/manifoldquery.py index 47b261f4..332309b2 100644 --- a/engine/manifoldquery.py +++ b/engine/manifoldquery.py @@ -51,12 +51,15 @@ class ManifoldQuery: # xxx # this should build an object from a dict as received from javascript # to see an example just look at the server's output - # incoming POST + # incoming POST def fill_from_dict (self, d): - # mandatory... - self.action=d['query[action]'] - self.method=d['query[method]'] - self.fields=[d['query[fields][]']] - self.timestamp=d['query[ts]'] - #self.filters=d['filters'] - #self.params=d['params'] + for key in d.keys(): + for arg in ['action', 'method', 'filters', 'fields', 'timestamp', 'params']: + if arg in key: + # dirty hack around fields; fields must be a list + if arg == 'fields': + setattr(self, arg, [d[key]]) + else: + setattr(self, arg, d[key]) + break +