Commit 1d6f4d59 authored by Marc Duez's avatar Marc Duez
Browse files
parents c05f996e 336a4181
......@@ -119,6 +119,8 @@ Database.prototype = {
} else {
self.check_cert()
}
self.warn("callUrl: " + status + " - " + url.replace(self.db_address, '') + "?" + this.argsToStr(args))
}
});
......@@ -355,12 +357,14 @@ Database.prototype = {
request: function (controller_name, args, quiet) {
var self = this;
var url = controller_name + "?" + this.argsToStr(args);
//envoye de la requete ajax
$.ajax({
type: "POST",
timeout: DB_TIMEOUT_CALL,
crossDomain: true,
url: self.db_address + controller_name + "?" + this.argsToStr(args),
url: self.db_address + url,
xhrFields: {withCredentials: true},
success: function (result) {
if (typeof quiet == 'undefined')
......@@ -373,6 +377,11 @@ Database.prototype = {
} else {
self.call("patient/index")
}
if (typeof quiet == 'undefined') {
// This triggers another request() call, but this time with quiet=true
self.warn("request: " + status + " - " + url)
}
}
});
},
......@@ -676,6 +685,8 @@ Database.prototype = {
},
// Log functions, to server
// 'quiet' is set to true to avoid infinite loops with timeouts
log : function (lvl, msg) { this.request('default/logger', {'lvl': lvl, 'msg': msg}, true) },
debug: function(msg) { this.log(10, msg) },
info: function(msg) { this.log(20, msg) },
......
# coding: utf8
import gluon.contrib.simplejson, datetime
import vidjil_utils
import time
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
......@@ -116,6 +118,8 @@ def info():
def custom():
start = time.time()
if request.vars["config_id"] and request.vars["config_id"] != "-1" :
config_id = long(request.vars["config_id"])
config_name = db.config[request.vars["config_id"]].name
......@@ -167,8 +171,7 @@ def custom():
if config :
query = query.find(lambda row : ( row.results_file.config_id==config_id or (str(row.results_file.id) in request.vars["custom_list"])) )
res = {"message": "custom list (%s)" % config_name}
log.debug(res)
log.debug("patient/custom (%.3fs) %s" % (time.time()-start, request.vars["filter"]))
return dict(query=query,
config_id=config_id,
......@@ -178,7 +181,6 @@ def custom():
STATS_READLINES = 1000 # approx. size in which the stats are searched
def stats():
import time
start = time.time()
d = custom()
......@@ -268,8 +270,6 @@ def stats():
## return patient list
def index():
import time
start = time.time()
if not auth.user :
res = {"redirect" : URL('default', 'user', args='login', scheme=True, host=True,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment