X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifold%2Fmanifoldquery.py;h=feed5f5ba754c01574b53819732b92a579acddb2;hb=258ce18e803cc727b8fe764e43399bc517d9dae1;hp=b7f88c4af99fda056f92d6fc507f83d4e15b8623;hpb=20835fc7deb0d149293351f032af6e5d9e4a1952;p=unfold.git diff --git a/manifold/manifoldquery.py b/manifold/manifoldquery.py index b7f88c4a..feed5f5b 100644 --- a/manifold/manifoldquery.py +++ b/manifold/manifoldquery.py @@ -61,18 +61,20 @@ class ManifoldQuery: return result # this builds a ManifoldQuery object from a dict as received from javascript through its ajax request + # we use a json-encoded string - see manifold.js for the sender part # e.g. here's what I captured from the server's output - # incoming POST - def fill_from_dict (self, d): - for key in d.keys(): - for arg in ['action', 'subject', '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 + # manifoldproxy.proxy: request.POST + def fill_from_POST (self, POST_dict): + try: + json_string=POST_dict['json'] + dict=json.loads(json_string) + for (k,v) in dict.iteritems(): + setattr(self,k,v) + except: + print "Could not decode incoming ajax request as a Query, POST=",POST_dict + if (debug): + import traceback + traceback.print_exc() # not used yet .. def analyze_subqueries(self):