commit/galaxy-central: carlfeberhard: history panel: comment out console statements; controllers/visualization: remove non-2.5 compliant 'with' statement
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/e0e5462cb049/ changeset: e0e5462cb049 user: carlfeberhard date: 2012-11-29 23:43:15 summary: history panel: comment out console statements; controllers/visualization: remove non-2.5 compliant 'with' statement affected #: 4 files diff -r dc83012e4b83cbf33c45b28982232bfcfcd29f3b -r e0e5462cb0495fc856ed5bd4a47bf386ac990a61 lib/galaxy/webapps/galaxy/controllers/visualization.py --- a/lib/galaxy/webapps/galaxy/controllers/visualization.py +++ b/lib/galaxy/webapps/galaxy/controllers/visualization.py @@ -801,14 +801,22 @@ # try to get the first line (assuming it's a header) #TODO: doesn't belong here try: - with open( hda.file_name ) as infile: - for index, line in enumerate( infile ): - if 'comment_lines' not in hda_dict: - hda_dict[ 'comment_lines' ] = [] - hda_dict[ 'comment_lines' ].append( line ) - if index >= 3: - break + num_comment_lines = 1 + if hda_dict[ 'metadata_comment_lines' ]: + num_comment_lines = hda_dict[ 'metadata_comment_lines' ] + + infile = open( hda.file_name ) + for index, line in enumerate( infile ): + if 'comment_lines' not in hda_dict: + hda_dict[ 'comment_lines' ] = [] + hda_dict[ 'comment_lines' ].append( line ) + if index >= num_comment_lines: + break + infile.close() + except Exception, exc: + if infile: + infile.close() log.error( str( exc ) ) history_id = trans.security.encode_id( hda.history.id ) diff -r dc83012e4b83cbf33c45b28982232bfcfcd29f3b -r e0e5462cb0495fc856ed5bd4a47bf386ac990a61 static/scripts/mvc/history/history-model.js --- a/static/scripts/mvc/history/history-model.js +++ b/static/scripts/mvc/history/history-model.js @@ -187,9 +187,9 @@ // if not interruption by iframe reload //TODO: remove when iframes are removed if( !( ( xhr.readyState === 0 ) && ( xhr.status === 0 ) ) ){ - if( console && console.warn ){ - console.warn( 'Error getting history updates from the server:', xhr, status, error ); - } + //if( console && console.warn ){ + // console.warn( 'Error getting history updates from the server:', xhr, status, error ); + //} alert( _l( 'Error getting history updates from the server.' ) + '\n' + error ); } }); diff -r dc83012e4b83cbf33c45b28982232bfcfcd29f3b -r e0e5462cb0495fc856ed5bd4a47bf386ac990a61 static/scripts/packed/mvc/history/history-model.js --- a/static/scripts/packed/mvc/history/history-model.js +++ b/static/scripts/packed/mvc/history/history-model.js @@ -1,1 +1,1 @@ -var History=BaseModel.extend(LoggableMixin).extend({defaults:{id:"",name:"",state:"",diskSize:0,deleted:false,annotation:null,message:null},urlRoot:"api/histories/",url:function(){return"api/histories/"+this.get("id")},initialize:function(a,b){this.log(this+".initialize:",a,b);this.hdas=new HDACollection();if(b&&b.length){this.hdas.reset(b);this.checkForUpdates()}},loadFromApi:function(a,c){var b=this;b.attributes.id=a;jQuery.when(jQuery.ajax("api/users/current"),b.fetch()).then(function(e,d){b.attributes.user=e[0];b.trigger("loaded:user",e[0]);b.trigger("loaded",d[0])}).then(function(){jQuery.ajax(b.url()+"/contents?"+jQuery.param({ids:b.hdaIdsFromStateIds().join(",")})).success(function(d){b.hdas.reset(d);b.checkForUpdates();b.trigger("loaded:hdas",d);if(c){callback(b)}})})},hdaIdsFromStateIds:function(){return _.reduce(_.values(this.get("state_ids")),function(b,a){return b.concat(a)})},checkForUpdates:function(a){if(this.hdas.running().length){this.stateUpdater()}else{this.trigger("ready")}return this},stateUpdater:function(){var c=this,a=this.get("state"),b=this.get("state_ids");jQuery.ajax("api/histories/"+this.get("id")).success(function(d){c.set(d);c.log("current history state:",c.get("state"),"(was)",a,"new size:",c.get("nice_size"));var e=[];_.each(_.keys(d.state_ids),function(g){var f=_.difference(d.state_ids[g],b[g]);e=e.concat(f)});if(e.length){c.hdas.update(e)}if((c.get("state")===HistoryDatasetAssociation.STATES.RUNNING)||(c.get("state")===HistoryDatasetAssociation.STATES.QUEUED)){setTimeout(function(){c.stateUpdater()},4000)}else{c.trigger("ready")}}).error(function(f,d,e){if(!((f.readyState===0)&&(f.status===0))){if(console&&console.warn){console.warn("Error getting history updates from the server:",f,d,e)}alert(_l("Error getting history updates from the server.")+"\n"+e)}})},toString:function(){var a=(this.get("name"))?(","+this.get("name")):("");return"History("+this.get("id")+a+")"}});var HistoryCollection=Backbone.Collection.extend(LoggableMixin).extend({model:History,urlRoot:"api/histories"}); \ No newline at end of file +var History=BaseModel.extend(LoggableMixin).extend({defaults:{id:"",name:"",state:"",diskSize:0,deleted:false,annotation:null,message:null},urlRoot:"api/histories/",url:function(){return"api/histories/"+this.get("id")},initialize:function(a,b){this.log(this+".initialize:",a,b);this.hdas=new HDACollection();if(b&&b.length){this.hdas.reset(b);this.checkForUpdates()}},loadFromApi:function(a,c){var b=this;b.attributes.id=a;jQuery.when(jQuery.ajax("api/users/current"),b.fetch()).then(function(e,d){b.attributes.user=e[0];b.trigger("loaded:user",e[0]);b.trigger("loaded",d[0])}).then(function(){jQuery.ajax(b.url()+"/contents?"+jQuery.param({ids:b.hdaIdsFromStateIds().join(",")})).success(function(d){b.hdas.reset(d);b.checkForUpdates();b.trigger("loaded:hdas",d);if(c){callback(b)}})})},hdaIdsFromStateIds:function(){return _.reduce(_.values(this.get("state_ids")),function(b,a){return b.concat(a)})},checkForUpdates:function(a){if(this.hdas.running().length){this.stateUpdater()}else{this.trigger("ready")}return this},stateUpdater:function(){var c=this,a=this.get("state"),b=this.get("state_ids");jQuery.ajax("api/histories/"+this.get("id")).success(function(d){c.set(d);c.log("current history state:",c.get("state"),"(was)",a,"new size:",c.get("nice_size"));var e=[];_.each(_.keys(d.state_ids),function(g){var f=_.difference(d.state_ids[g],b[g]);e=e.concat(f)});if(e.length){c.hdas.update(e)}if((c.get("state")===HistoryDatasetAssociation.STATES.RUNNING)||(c.get("state")===HistoryDatasetAssociation.STATES.QUEUED)){setTimeout(function(){c.stateUpdater()},4000)}else{c.trigger("ready")}}).error(function(f,d,e){if(!((f.readyState===0)&&(f.status===0))){alert(_l("Error getting history updates from the server.")+"\n"+e)}})},toString:function(){var a=(this.get("name"))?(","+this.get("name")):("");return"History("+this.get("id")+a+")"}});var HistoryCollection=Backbone.Collection.extend(LoggableMixin).extend({model:History,urlRoot:"api/histories"}); \ No newline at end of file diff -r dc83012e4b83cbf33c45b28982232bfcfcd29f3b -r e0e5462cb0495fc856ed5bd4a47bf386ac990a61 templates/root/alternate_history.mako --- a/templates/root/alternate_history.mako +++ b/templates/root/alternate_history.mako @@ -304,12 +304,11 @@ Galaxy.historyFrame = window; // ostensibly, this is the App - if( console && console.debug ){ - //if( console.clear ){ console.clear(); } - console.pretty = function( o ){ $( '<pre/>' ).text( JSON.stringify( o, null, ' ' ) ).appendTo( 'body' ); } - top.storage = jQuery.jStorage - } - + //if( console && console.debug ){ + // //if( console.clear ){ console.clear(); } + // console.pretty = function( o ){ $( '<pre/>' ).text( JSON.stringify( o, null, ' ' ) ).appendTo( 'body' ); } + // top.storage = jQuery.jStorage + //} // LOAD INITIAL DATA IN THIS PAGE - since we're already sending it... // ...use mako to 'bootstrap' the models @@ -330,7 +329,7 @@ var historyPanel = new HistoryPanel({ model : new History( history, hdas ), urlTemplates : galaxy_paths.attributes, - logger : console, + //logger : console, // is page sending in show settings? if so override history's show_deleted : ${ 'true' if show_deleted == True else ( 'null' if show_deleted == None else 'false' ) }, show_hidden : ${ 'true' if show_hidden == True else ( 'null' if show_hidden == None else 'false' ) } Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket