Corrected behavior of upload tool under 2 conditions: 1) if user clicks execute button with no posted data or URL and 2) if user uploads an empty file.

This commit is contained in:
Greg Von Kuster
2007-04-05 19:57:58 +00:00
parent 6ea6c7bad1
commit 18b25d241f
5 changed files with 23 additions and 7 deletions
+4 -4
View File
@@ -47,19 +47,19 @@ class UploadToolAction( object ):
except:
pass
if self.empty:
return self.upload_failed(trans, "Empty file error:", "you attempted to upload an empty file")
return self.upload_empty(trans, "Empty file error:", "you attempted to upload an empty file")
elif len(data_list)<1:
return self.upload_failed(trans, "No data error:","either you pasted no data, the url you specified is invalid, or you have not specified a file")
return self.upload_empty(trans, "No data error:","either you pasted no data, the url you specified is invalid, or you have not specified a file")
return dict( output=data_list[0] )
def upload_failed(self, trans, err_code, err_msg):
def upload_empty(self, trans, err_code, err_msg):
data = trans.app.model.Dataset()
data.name = err_code
data.extension = "text"
data.dbkey = "?"
data.info = err_msg
data.flush()
data.state = jobs.JOB_ERROR
data.state = data.states.EMPTY
trans.history.add_dataset( data )
trans.app.model.flush()
return dict( output=data )
Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

@@ -40,6 +40,20 @@ div.historyItem-ok
}
div.historyItem-empty
{
padding: 5px;
padding-right: 15px;
padding-left: 15px;
margin-bottom: 5px;
border-top: solid #AA6666 1px;
border-bottom: solid #AA6666 1px;
background: #FFCCCC;
background-image: url(/static/style/error_bg.png);
background-repeat: repeat-x;
background-position: top;
}
div.historyItem-error
{
padding: 5px;
Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

+5 -3
View File
@@ -186,11 +186,13 @@ main();">
#elif $data_state == "error"
<div>An error occurred running this job: <i>$data.display_info</i>, <a href="${h.url_for( controller='dataset', action='errors', id=$data.id )}" target="galaxy_main">report this error</a></div>
#*<a href="delete?id=$data.id">delete</a> *#
#elif $data_state == "empty"
<div>No data: <i>$data.display_info</i></div>
#else
<div>
$data.blurb,
format: <span class="$data.ext">$data.ext</span>,
database:
$data.blurb,
format: <span class="$data.ext">$data.ext</span>,
database:
#if $data.dbkey == '?'
<a href="edit?id=$data.id" target="galaxy_main"><span class="$data.dbkey">$data.dbkey</span></a>
#else