details: http://www.bx.psu.edu/hg/galaxy/rev/2a81c4b95e20 changeset: 1722:2a81c4b95e20 user: Greg Von Kuster <greg@bx.psu.edu> date: Mon Jan 26 14:41:00 2009 -0500 description: Add a make_dict_copy method to Tool.execute so that when wrapping the tool's inputs to display output labels and such, we are not overwriting the incoming param dictionary. Also, yet another fix for tranlsating EOL to <br/> so they can be displayed in the data.info in the histoy. 2 file(s) affected in this change: lib/galaxy/datatypes/data.py lib/galaxy/tools/actions/__init__.py diffs (77 lines): diff -r 9abb83ad372d -r 2a81c4b95e20 lib/galaxy/datatypes/data.py --- a/lib/galaxy/datatypes/data.py Sat Jan 24 12:13:47 2009 -0500 +++ b/lib/galaxy/datatypes/data.py Mon Jan 26 14:41:00 2009 -0500 @@ -137,13 +137,14 @@ """Returns formatted html of dataset info""" try: # Change new line chars to html - if dataset.info.find( '\r\n' ) >= 0: - dataset.info = dataset.info.replace( '\r\n', '<br/>' ) - if dataset.info.find( '\r' ) >= 0: - dataset.info = dataset.info.replace( '\r', '<br/>' ) - if dataset.info.find( '\n' ) >= 0: - dataset.info = dataset.info.replace( '\n', '<br/>' ) - return escape( dataset.info ) + info = escape( dataset.info ) + if info.find( '\r\n' ) >= 0: + info = info.replace( '\r\n', '<br/>' ) + if info.find( '\r' ) >= 0: + info = info.replace( '\r', '<br/>' ) + if info.find( '\n' ) >= 0: + info = info.replace( '\n', '<br/>' ) + return info except: return "info unavailable" def validate(self, dataset): diff -r 9abb83ad372d -r 2a81c4b95e20 lib/galaxy/tools/actions/__init__.py --- a/lib/galaxy/tools/actions/__init__.py Sat Jan 24 12:13:47 2009 -0500 +++ b/lib/galaxy/tools/actions/__init__.py Mon Jan 26 14:41:00 2009 -0500 @@ -6,6 +6,7 @@ from galaxy.web import url_for from galaxy.jobs import JOB_OK import galaxy.tools +from types import * import logging log = logging.getLogger( __name__ ) @@ -65,8 +66,21 @@ param_values[input.name] = input_datasets[ prefix + input.name ] tool.visit_inputs( param_values, visitor ) return input_datasets - + def execute(self, tool, trans, incoming={}, set_output_hid=True ): + def make_dict_copy( from_dict ): + """ + Makes a copy of input dictionary from_dict such that all values that are dictionaries + result in creation of a new dictionary ( a sort of deepcopy ). We may need to handle + other complex types ( e.g., lists, etc ), but not sure... + """ + copy_from_dict = {} + for key, value in from_dict.items(): + if type( value ).__name__ == 'dict': + copy_from_dict[ key ] = make_dict_copy( value ) + else: + copy_from_dict[ key ] = value + return copy_from_dict def wrap_values( inputs, input_values ): # Wrap tool inputs as necessary for input in inputs.itervalues(): @@ -75,7 +89,7 @@ wrap_values( input.inputs, d ) elif isinstance( input, Conditional ): values = input_values[ input.name ] - current = values["__current_case__"] + current = values[ "__current_case__" ] wrap_values( input.cases[current].inputs, values ) elif isinstance( input, DataToolParameter ): input_values[ input.name ] = \ @@ -172,7 +186,7 @@ data.blurb = "queued" # Set output label if output.label: - params = dict( incoming ) + params = make_dict_copy( incoming ) # wrapping the params allows the tool config to contain things like # <outputs> # <data format="input" name="output" label="Blat on ${<input_param>.name}" />