Commit 61ffbdd0 authored by Ryan Herbert's avatar Ryan Herbert
Browse files

file.py failsafe if initial set token is removed

The redirection at the end of the submission controller checks the
initial sample-set-type in order to redirect to the source sample-set.
But if the initial sample-set is removed from the list of sets to add a
sample to, then we need to ensure we still have a set to redirect to.
parent 02ec44e8
......@@ -242,7 +242,10 @@ def submit():
db.sequence_file[id] = data
ssid_dict = link_to_sample_sets(id, id_dict)
redirect_args = {"id" : ssid_dict[request.vars["sample_type"]][0]}
if request.vars["sample_type"] in ssid_dict:
redirect_args = {"id" : ssid_dict[request.vars["sample_type"]][0]}
else:
redirect_args = {"id": ssid_dict[ssid_dict.keys()[0]][0]}
res = {"file_id" : id,
"message": "file {%d}: metadata saved" % id,
......
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