Commit ffb3543e authored by Mikaël Salson's avatar Mikaël Salson
Browse files

file.py: warn user on system error at upload

Catch all IOError during processing of uploaded file. When filename appears
to be too long we should also probably warn the user before the upload is
finished, as soon as they submit their file.

This case cannot be tested as unit tests don't really store files on
disk when testing upload
parent 4f5d51c1
......@@ -158,8 +158,15 @@ def upload():
log.debug(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))
mes += "upload finished"
try:
db.sequence_file[request.vars["id"]] = dict(data_file = db.sequence_file.data_file.store(f.file, f.filename))
mes += "upload finished"
except IOError as e:
if str(e).find("File name too long") > -1:
error += 'Your filename is too long, please shorten it'
else:
error += "System error during processing of uploaded file"
log.error(str(e))
data_file = db.sequence_file[request.vars["id"]].data_file
......
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