Attention une mise à jour du serveur va être effectuée le vendredi 16 avril entre 12h et 12h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 818a95a4 authored by HERBERT Ryan's avatar HERBERT Ryan

controllers/sample_set.py editing generic sample_sets

moodified the existing sample_set.py routes to enable editing of generic
sample_sets
parent 16dd3063
......@@ -360,17 +360,51 @@ def add_form():
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def edit():
sample_type = db.sample_set[request.vars["id"]].sample_type
sample_set = db.sample_set[request.vars["id"]]
sample_type = samle_set.sample_type
if sample_type == "patient" :
patient = db((db.patient.sample_set_id == request.vars["id"])).select()[0]
redirect(URL('patient', 'edit', vars=dict(id=patient.id)), headers=response.headers)
if sample_type == "run" :
elif sample_type == "run" :
run = db((db.run.sample_set_id == request.vars["id"])).select()[0]
redirect(URL('run', 'edit', vars=dict(id=run.id)), headers=response.headers)
else :
if (auth.can_modify_sample_set(sample_set.id)):
return dict(message=T('edit sample_set'))
else :
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def edit_form():
if (auth.can_modify_sample_set(request.vars["id"]) ):
error = ""
if request.vars["name"] == "" :
error += "name needed, "
if request.vars["id"] == "" :
error += "sample set id needed, "
if error=="" :
db.sample_set[request.vars["id"]] = dict(first_name=request.vars["name"],
info=request.vars["info"],
)
res = {"redirect": "back",
"message": "%s (%s): sample_set edited" % (request.vars["name"], request.vars["id"])}
log.info(res, extra={'user_id': auth.user.id, 'record_id': request.vars['id'], 'table_name': 'sample_set'})
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"success" : "false", "message" : error}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"message": ACCESS_DENIED}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def custom():
start = time.time()
......
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