From 336244a760ef1e458d0f1a9acfc9d5d06f6e0c30 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Mon, 11 Mar 2013 14:51:27 +0100 Subject: [PATCH] debug & renamings --- engine/manifoldapi.py | 9 ++++++++- engine/manifoldproxy.py | 7 +++++++ engine/pluginset.py | 6 +++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/engine/manifoldapi.py b/engine/manifoldapi.py index ebb6b4a9..111241c5 100644 --- a/engine/manifoldapi.py +++ b/engine/manifoldapi.py @@ -25,7 +25,14 @@ class ManifoldAPI: def __getattr__(self, methodName): def func(*args, **kwds): result=getattr(self.proxy, methodName)(self.auth, *args, **kwds) - if debug: print '===> backend call',methodName, self.auth, self.url,'->',result + ### debug + if debug: + print '===> backend call',methodName, self.auth, self.url,'->', + if not result: print "no/empty result" + elif isinstance (result,str): print "result is '%s'"%result + elif isinstance (result,list): print "result is a %d-elts list"%len(result) + else: print "dont know how to display result" + ### return result return func diff --git a/engine/manifoldproxy.py b/engine/manifoldproxy.py index 20e95929..d5a4ab08 100644 --- a/engine/manifoldproxy.py +++ b/engine/manifoldproxy.py @@ -6,6 +6,10 @@ from django.http import HttpResponse, HttpResponseForbidden from engine.manifoldquery import ManifoldQuery from engine.manifoldapi import ManifoldAPI +# add artificial delay in s +debug_spin=0 +#debug_spin=1 + # this view is what the javascript talks to when it sends a query # see also # myslice/urls.py @@ -34,6 +38,9 @@ with the query passed using POST""" # actually forward manifold_api= ManifoldAPI(auth=manifold_api_session_auth) answer=manifold_api.send_manifold_query (manifold_query) + if debug_spin: + import time + time.sleep(debug_spin) # return json-encoded answer return HttpResponse (json.dumps(answer), mimetype="application/json") diff --git a/engine/pluginset.py b/engine/pluginset.py index 0a0e291f..be8c9ced 100644 --- a/engine/pluginset.py +++ b/engine/pluginset.py @@ -45,12 +45,12 @@ class PluginSet: # return the javascript that triggers all the queries def exec_queue_asynchroneously (self): js = "" - js += "var manifold_query_array = new Array();\n" + js += "var async_queries = new Array();\n" for (query,domid) in self._queue: qjson=query.to_json() id="'%s'"%domid if domid else 'undefined' - js += "manifold_query_array.push({'query':%(qjson)s, 'id':%(id)s});\n"%locals() - js += "onFunctionAvailable('manifold_async_exec', function() {manifold_async_exec(manifold_query_array);}, this, true);" + js += "async_queries.push({'query':%(qjson)s, 'id':%(id)s});\n"%locals() + js += "onFunctionAvailable('manifold_async_exec', function() {manifold_async_exec(async_queries);}, this, true);" self.reset_queue() # run only once the document is ready js = "$(document).ready(function(){%(js)s})"%locals() -- 2.45.2