X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=unfold%2Fpage.py;h=b49dce123ec817a2832f2362205f72ade8acb1ca;hb=401546ae932e7f2d120ec210c13e2db1ce754cc7;hp=54d3309b8d687269ec59ed10c10d5d808194335c;hpb=69867d5296684463d3aad4f6db867d24005102aa;p=myslice.git diff --git a/unfold/page.py b/unfold/page.py index 54d3309b..b49dce12 100644 --- a/unfold/page.py +++ b/unfold/page.py @@ -49,13 +49,21 @@ class Page: # this method adds a query to the page # the query will be exposed to js when calling expose_queries - # additionally if exec is set to True, this query will be asynchroneously triggered on page load + # additionally if run_it is set to True, this query will be asynchroneously triggered on page load # in this case (exec=True) the js async callback (see manifold.asynchroneous_success) # offers the option to deliver the result to a specific DOM elt (in this case, set domid) # otherwise (i.e. if domid not provided), it goes through the pubsub system (so all plugins can receive it) - def enqueue_query (self, query, run_it=True, domid=None): + # + # NOTE: + # analyzed_query is required because it contains query_uuid that the + # plugins initialized in the python part will listen to. When a result is + # received in javascript, subresults should be publish to the appropriate + # query_uuid. + # + def enqueue_query (self, query, run_it=True, domid=None, analyzed_query=None): # _queries is the set of all known queries - self._queries = self._queries.union(set( [ query, ] )) + # XXX complex XXX self._queries = self._queries.union(set( [ query, ] )) + self._queries.add((query, analyzed_query)) # _queue is the list of queries that need to be triggered, with an optional domid # we only do this if run_it is set if run_it: self._queue.append ( (query.query_uuid,domid) ) @@ -67,7 +75,7 @@ class Page: # compute variables to expose to the template env = {} # expose the json definition of all queries - env['queries_json'] = [ query.to_json() for query in self._queries ] + env['queries_json'] = [ query.to_json(analyzed_query=aq) for (query, aq) in self._queries ] def query_publish_dom_tuple (a,b): result={'query_uuid':a} if b: result['domid']=b