commit/galaxy-central: greg: Add the ability to display tool form components that are inside conditionals for tools contained in repositories in the tool shed. Also fix tool shed functional tests I recently broke sue to messing with rendering readme files in tool shed repositories.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/2abd0819d354/ Changeset: 2abd0819d354 User: greg Date: 2013-07-24 22:36:52 Summary: Add the ability to display tool form components that are inside conditionals for tools contained in repositories in the tool shed. Also fix tool shed functional tests I recently broke sue to messing with rendering readme files in tool shed repositories. Affected #: 3 files diff -r ab4582614f70e35bb1023f73d4d2dc409225bc21 -r 2abd0819d354d3d11182297c7206408d299f0d16 lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -11,6 +11,7 @@ from galaxy import util from galaxy import web from galaxy.util.odict import odict +from galaxy.util.expressions import ExpressionContext from galaxy.web.base.controller import BaseUIController from galaxy.web.form_builder import CheckboxField from galaxy.web.form_builder import build_select_field @@ -1060,7 +1061,7 @@ repository, tool, message = tool_util.load_tool_from_changeset_revision( trans, repository_id, changeset_revision, tool_config ) if message: status = 'error' - tool_state = self.__new_state( trans ) + tool_state = self.__new_state( trans, tool, invalid=False ) metadata = self.get_metadata( trans, repository_id, changeset_revision ) try: return trans.fill_template( "/webapps/tool_shed/repository/tool_form.mako", @@ -1907,7 +1908,7 @@ status = kwd.get( 'status', 'error' ) render_repository_actions_for = kwd.get( 'render_repository_actions_for', 'tool_shed' ) repository, tool, error_message = tool_util.load_tool_from_changeset_revision( trans, repository_id, changeset_revision, tool_config ) - tool_state = self.__new_state( trans ) + tool_state = self.__new_state( trans, tool, invalid=True ) invalid_file_tups = [] if tool: invalid_file_tups = tool_util.check_tool_input_params( trans.app, @@ -2247,7 +2248,7 @@ self.email_alerts_repository_grid.title = "Set email alerts for repository changes" return self.email_alerts_repository_grid( trans, **kwd ) - def __new_state( self, trans, all_pages=False ): + def __new_state( self, trans, tool, invalid=False ): """ Create a new `DefaultToolState` for this tool. It will not be initialized with default values for inputs. @@ -2257,6 +2258,16 @@ """ state = galaxy.tools.DefaultToolState() state.inputs = {} + if invalid: + # We're attempting to display a tool in the tool shed that has been determined to have errors of some kind. + return state + inputs = tool.inputs_by_page[ 0 ] + context = ExpressionContext( state.inputs, parent=None ) + for input in inputs.itervalues(): + try: + state.inputs[ input.name ] = input.get_initial_value( trans, context ) + except: + state.inputs[ input.name ] = [] return state @web.json diff -r ab4582614f70e35bb1023f73d4d2dc409225bc21 -r 2abd0819d354d3d11182297c7206408d299f0d16 templates/webapps/tool_shed/repository/tool_form.mako --- a/templates/webapps/tool_shed/repository/tool_form.mako +++ b/templates/webapps/tool_shed/repository/tool_form.mako @@ -35,8 +35,11 @@ %elif input.type == "conditional": %if tool_state.items(): <% - group_state = tool_state[input.name][0] - current_case = group_state['__current_case__'] + try: + group_state = tool_state[ input.name ][ 0 ] + except Exception, e: + group_state = tool_state[ input.name ] + current_case = group_state[ '__current_case__' ] group_prefix = prefix + input.name + "|" %> %if input.value_ref_in_group: @@ -120,7 +123,7 @@ <div class="toolFormBody"><form id="tool_form" name="tool_form" action="" method="get"><input type="hidden" name="tool_state" value="${util.object_to_string( tool_state.encode( tool, app ) )}"> - ${do_inputs( tool.inputs_by_page[ tool_state.page ], tool_state.inputs, "" )} + ${do_inputs( tool.inputs_by_page[ tool_state.page ], tool_state.inputs, "" )} </form></div></div> diff -r ab4582614f70e35bb1023f73d4d2dc409225bc21 -r 2abd0819d354d3d11182297c7206408d299f0d16 test/tool_shed/functional/test_0000_basic_repository_features.py --- a/test/tool_shed/functional/test_0000_basic_repository_features.py +++ b/test/tool_shed/functional/test_0000_basic_repository_features.py @@ -151,7 +151,7 @@ commit_message="Uploaded filtering.txt", strings_displayed=[], strings_not_displayed=[] ) - self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) + self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) def test_0055_upload_filtering_test_data( self ): '''Upload filtering test data.''' @@ -219,19 +219,19 @@ commit_message="Uploaded readme.txt", strings_displayed=[], strings_not_displayed=[] ) - self.display_manage_repository_page( repository, strings_displayed=[ 'This is a readme file.' ] ) + self.display_manage_repository_page( repository, strings_displayed=[ 'This is a readme file.' ] ) # Verify that there is a different readme file for each metadata revision. metadata_revisions = self.get_repository_metadata_revisions( repository ) self.display_manage_repository_page( repository, - strings_displayed=[ 'Readme file for filtering 1.1.0', - 'This is a readme file.' ] ) + strings_displayed=[ 'Readme file for filtering 1.1.0', + 'This is a readme file.' ] ) def test_0075_delete_readme_txt_file( self ): '''Delete the readme.txt file.''' repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.delete_files_from_repository( repository, filenames=[ 'readme.txt' ] ) self.check_count_of_metadata_revisions_associated_with_repository( repository, metadata_count=2 ) - self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) + self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) def test_0080_search_for_valid_filter_tool( self ): '''Search for the filtering tool by tool ID, name, and version.''' @@ -335,7 +335,7 @@ commit_message="Uploaded new readme.txt with invalid ascii characters.", strings_displayed=[], strings_not_displayed=[] ) - self.display_manage_repository_page( repository, strings_displayed=[ 'These characters should not' ] ) + self.display_manage_repository_page( repository, strings_displayed=[ 'These characters should not' ] ) def test_0130_verify_handling_of_invalid_characters( self ): '''Load the above changeset in the change log and confirm that there is no server error displayed.''' 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)
-
commits-noreply@bitbucket.org