diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index a242047cde7..a3b4cf02dd0 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -1021,6 +1021,24 @@ class ToolBox( object, Dictifiable ): status = 'done' return message, status + def find_section_id( self, tool_panel_section_id ): + """ + Find the section ID referenced by the key or return '' indicating + no such section id. + """ + if not tool_panel_section_id: + tool_panel_section_id = '' + else: + if tool_panel_section_id not in self.tool_panel: + # Hack introduced without comment in a29d54619813d5da992b897557162a360b8d610c- + # not sure why it is needed. + fixed_tool_panel_section_id = 'section_%s' % tool_panel_section_id + if fixed_tool_panel_section_id in self.tool_panel: + tool_panel_section_id = fixed_tool_panel_section_id + else: + tool_panel_section_id = '' + return tool_panel_section_id + def load_workflow( self, workflow_id ): """ Return an instance of 'Workflow' identified by `id`, diff --git a/lib/tool_shed/galaxy_install/install_manager.py b/lib/tool_shed/galaxy_install/install_manager.py index 4d2ff603a32..8d5b8d21fa3 100644 --- a/lib/tool_shed/galaxy_install/install_manager.py +++ b/lib/tool_shed/galaxy_install/install_manager.py @@ -742,16 +742,7 @@ class InstallRepositoryManager( object ): tool_path = shed_config_dict[ 'tool_path' ] if not shed_tool_conf: raise exceptions.RequestParameterMissingException( "Missing required parameter 'shed_tool_conf'." ) - tool_panel_section_id = install_options.get( 'tool_panel_section_id', '' ) - if tool_panel_section_id not in [ None, '' ]: - if tool_panel_section_id not in self.app.toolbox.tool_panel: - fixed_tool_panel_section_id = 'section_%s' % tool_panel_section_id - if fixed_tool_panel_section_id in self.app.toolbox.tool_panel: - tool_panel_section_id = fixed_tool_panel_section_id - else: - tool_panel_section_id = '' - else: - tool_panel_section_id = '' + tool_panel_section_id = self.app.toolbox.find_section_id( install_options.get( 'tool_panel_section_id', '' ) ) # Build the dictionary of information necessary for creating tool_shed_repository database records # for each repository being installed. installation_dict = dict( install_repository_dependencies=install_repository_dependencies,