Commit 73647568 authored by Mathieu Giraud's avatar Mathieu Giraud Committed by Vidjil Team

controllers/*.py, models/task.py: log some actions

parent 9cb95de4
......@@ -75,10 +75,12 @@ def edit_form():
res = {"redirect": "config/index",
"message": "config saved"}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"success" : "false", "message" : error}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def confirm():
......
......@@ -60,6 +60,7 @@ def run_request():
else :
res = {"success" : "false",
"message" : "default/run_request : " + error}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -108,11 +109,13 @@ def get_data():
data["samples"]["original_names"].append(filename)
data["samples"]["info"].append(row.sequence_file.info)
log.info("get_data: %s -> %s" % (request.vars["patient_id"], fused_file))
return gluon.contrib.simplejson.dumps(data, separators=(',',':'))
else :
res = {"success" : "false",
"message" : "default/get_data : " + error}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
#########################################################################
......@@ -168,6 +171,7 @@ def get_analysis():
else :
res = {"success" : "false",
"message" : "default/get_analysis : " + error}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -209,10 +213,12 @@ def save_analysis():
res = {"success" : "true",
"message" : patient_name+": analysis saved"}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"success" : "false",
"message" : error}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......
......@@ -49,7 +49,8 @@ def add_form():
"redirect": "patient/info",
"args" : {"id" : request.vars['patient_id']}
}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
......@@ -99,7 +100,8 @@ def edit_form():
res = {"file_id" : request.vars['id'],
"redirect": "patient/info",
"args" : { "id" : patient_id},
"message": "change saved"}
"message": "%s: metadata saved" % request.vars['filename']}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def upload():
......@@ -140,6 +142,7 @@ def delete():
res = {"redirect": "patient/info",
"args" : { "id" : patient_id},
"message": "sequence file deleted"}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else:
res = {"success" : "false", "message" : "you need admin permission to delete this file"}
......
......@@ -8,6 +8,7 @@ if request.env.http_origin:
## return patient file list
##
def info():
log.info('info()')
if (auth.has_permission('read', 'patient', request.vars["id"]) ):
return dict(message=T('patient'))
else :
......@@ -78,6 +79,7 @@ def add_form():
res = {"redirect": "patient/info",
"args" : { "id" : id },
"message": patient_name + ": patient added"}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
......@@ -128,7 +130,8 @@ def edit_form():
)
res = {"redirect": "back",
"message": "change saved"}
"message": "patient %s %s edited" % (request.vars["first_name"], request.vars["last_name"])}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
......@@ -146,6 +149,7 @@ def download():
#
def confirm():
if (auth.has_permission('admin', 'patient', request.vars["id"]) ):
log.info('patient deleted')
return dict(message=T('confirm patient deletion'))
else :
res = {"message": "acces denied"}
......@@ -170,9 +174,11 @@ def delete():
res = {"redirect": "patient/index",
"success": "true",
"message": "patient ("+request.vars["id"]+") deleted"}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"message": "acces denied"}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......
......@@ -23,6 +23,7 @@ def run_all():
res = {"success" : "true",
"message" : "rerun all"}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
## display run page result
......@@ -69,7 +70,8 @@ def delete():
"args" : { "id" : patient_id,
"config_id" : config_id},
"success": "true",
"message": "run ("+str(request.vars["results_file_id"])+") deleted"}
"message": "process ("+str(request.vars["results_file_id"])+") deleted"}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"message": "acces denied"}
......
......@@ -50,8 +50,9 @@ def schedule_run(id_sequence, id_config):
patient_name = db.patient[id_patient].first_name + " " + db.patient[id_patient].last_name
res = {"redirect": "reload",
"message": "default/run_request : request added to run config " + config_name + " on " + filename + " for " + patient_name }
"message": "%s (%s) %s: process requested" % (patient_name, config_name, filename)}
log.info(res)
return res
......
Markdown is supported
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