-
- def reset_queue (self):
- self._queries = set()
- self._queue = []
-
- # the js async methods (see manifold.asynchroneous_success)
- # offer the option to deliver the result to a specific DOM elt
- # otherwise (i.e. if domid not provided)
- # it goes through the pubsub using query's uuid
- def enqueue_query (self, query, domid=None):
- self._queries = self._queries.union(set( [ query, ] ))
- self._queue.append ( (query.query_uuid,domid,) )
-
- # return the javascript that triggers all the queries
- # xxx could fruitfully be renamed expose_queries_to_javascript or something
- def exec_queue_asynchroneously (self):
+
+ # not sure this is useful at all
+# def reset_queue (self):
+# self._queries = set()
+# self._queue = []
+
+ # this method adds a query to the page
+ # the query will be exposed to js when calling expose_queries
+ # 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)
+ #
+ # 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
+ # 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) )
+
+ # return the javascript code for exposing queries
+ # all queries are inserted in the global manifold object
+ # in addition, the ones enqueued with 'run_it=True' are triggered
+ def expose_queries (self):