Commit 610a2390 authored by Marc Duez's avatar Marc Duez
parents 728effde ce57c74a
......@@ -82,7 +82,9 @@ function Com(flash_id, log_id, popup_id, data_id) {
"database_timeout": "Cannot connect database, please retry in a few seconds",
"save_analysis": "change will be lost, are you sure you want to load another file ?"
"save_analysis": "You made some changes in the analysis of the previous patient"
+ "</br>that were not saved (patients → save analysis)."
+ "</br>These changes will now be lost, do you want to proceed anyway?"
}
......
......@@ -12,9 +12,11 @@ if request.env.http_origin:
def add():
if not auth.has_permission('admin', 'patient', request.vars['id'], auth.user_id):
res = {"success" : "false", "message" : "you need admin permission on this patient to add files"}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
elif not auth.has_permission('upload', 'sequence_file', request.vars['id'], auth.user_id):
res = {"success" : "false", "message" : "you don't have right to upload files"}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else:
query = db((db.sequence_file.patient_id==request.vars['id'])).select()
......@@ -46,6 +48,7 @@ def add_form():
query = db((db.sequence_file.patient_id==request.vars['patient_id'])).select()
for row in query :
if row.filename == request.vars['filename'] :
log.error(res)
res = {"message": "this sequence file already exists for this patient"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -69,6 +72,7 @@ def add_form():
else :
res = {"success" : "false", "message" : error}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -80,6 +84,7 @@ def edit():
# return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else:
res = {"success" : "false", "message" : "you need admin permission to edit files"}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -126,6 +131,11 @@ def upload():
if error=="" :
mes = "file " + request.vars['id'] + " : "
res = {"message": mes + ": processing uploaded file",
"redirect": "patient/info",
"args" : {"id" : request.vars['id']}
}
log.info(res)
if request.vars.file != None :
f = request.vars.file
db.sequence_file[request.vars["id"]] = dict(data_file = db.sequence_file.data_file.store(f.file, f.filename))
......@@ -136,6 +146,7 @@ def upload():
db.sequence_file[request.vars["id"]] = dict(size_file = size)
res = {"message": mes}
log.info(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -144,6 +155,7 @@ def confirm():
return dict(message=T('confirm sequence file deletion'))
else:
res = {"success" : "false", "message" : "you need admin permission to delete this file"}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -163,6 +175,7 @@ def delete():
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else:
res = {"success" : "false", "message" : "you need admin permission to delete this file"}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......
......@@ -249,9 +249,11 @@ class MsgUserAdapter(logging.LoggerAdapter):
else:
msg = '?'
ip = request.client
if ip in ips:
ip = "%s/%s" % (ip, ips[ip])
new_msg = '%15s <%s> %s' % (ip, (auth.user.first_name if auth.user else ''), msg)
if ip:
for ip_prefix in ips:
if ip.startswith(ip_prefix):
ip = "%s/%s" % (ip, ips[ip_prefix])
new_msg = '%30s %12s %s' % (ip, ('<%s>' % auth.user.first_name if auth.user else ''), msg)
return new_msg, kwargs
#
......
......@@ -3,7 +3,7 @@ import os
import sys
import defs
TASK_TIMEOUT = 10 * 60
TASK_TIMEOUT = 15 * 60
def schedule_run(id_sequence, id_config):
import time, datetime, sys, os.path
......@@ -42,6 +42,7 @@ def schedule_run(id_sequence, id_config):
if len(row3) > 0 :
res = {"message": "run already registered"}
log.error(res)
return res
......@@ -56,7 +57,7 @@ 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": "%s (%s) %s: process requested" % (patient_name, config_name, filename)}
"message": "[%s] (%s): process requested - %s - %s" % (data_id, config_name, patient_name, filename)}
log.info(res)
return res
......@@ -133,6 +134,11 @@ def run_vidjil(id_file, id_config, id_data, id_fuse, clean_before=False, clean_a
## l'output de Vidjil est stocké comme resultat pour l'ordonnanceur
## TODO parse result success/fail
config_name = db.config[id_config].name
res = {"message": "[%s] (%s): Vidjil finished - %s" % (id_data, config_name, out_folder)}
log.info(res)
run_fuse(id_file, id_config, id_data, id_fuse, clean_before = False)
return "SUCCESS"
......@@ -190,6 +196,10 @@ def run_copy(id_file, id_config, id_data, id_fuse, clean_before=False, clean_aft
## l'output de Vidjil est stocké comme resultat pour l'ordonnanceur
## TODO parse result success/fail
config_name = db.config[id_config].name
res = {"message": "[%s] (%s): 'copy' finished - %s" % (id_data, config_name, filename)}
log.info(res)
run_fuse(id_file, id_config, id_data, id_fuse, clean_before = False)
return "SUCCESS"
......@@ -260,6 +270,10 @@ def run_fuse(id_file, id_config, id_data, id_fuse, clean_before=True, clean_afte
p = Popen(clean_cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
p.wait()
config_name = db.config[id_config].name
res = {"message": "[%s] (%s): 'fuse' finished - %s" % (id_data, config_name, output_file)}
log.info(res)
return "SUCCESS"
......
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