Eliminate one reference to ToolBox.tool_panel in install_manager.py.

This commit is contained in:
John Chilton
2014-12-28 11:23:44 -05:00
parent 7af172dbda
commit 4068aaac92
2 changed files with 19 additions and 10 deletions
+18
View File
@@ -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`,
@@ -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,