diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 19e05bf92f9..c026b8fe481 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -1147,24 +1147,22 @@ class ToolBox( object, Dictifiable ): """ return self.app.model.context + def tool_panel_contents( self, trans, **kwds ): + """ Filter tool_panel contents for displaying for user. + """ + context = Bunch( toolbox=self, trans=trans ) + filters = self.filter_factory.build_filters( trans ) + for elt in self.tool_panel.itervalues(): + elt = _filter_for_panel( elt, filters, context ) + if elt: + yield elt + def to_dict( self, trans, in_panel=True, **kwds ): """ to_dict toolbox. """ - - context = Bunch( toolbox=self, trans=trans, **kwds ) if in_panel: - panel_elts = [ val for val in self.tool_panel.itervalues() ] - - filters = self.filter_factory.build_filters( trans, **kwds ) - - filtered_panel_elts = [] - for index, elt in enumerate( panel_elts ): - elt = _filter_for_panel( elt, filters, context ) - if elt: - filtered_panel_elts.append( elt ) - panel_elts = filtered_panel_elts - + panel_elts = list( self.tool_panel_contents( trans, **kwds ) ) # Produce panel. rval = [] kwargs = dict( diff --git a/templates/admin/package_tool.mako b/templates/admin/package_tool.mako index fef8ac765d5..1557a5a8273 100644 --- a/templates/admin/package_tool.mako +++ b/templates/admin/package_tool.mako @@ -26,7 +26,7 @@ $().ready(function() { Tool to bundle: - %for key, val in toolbox.tool_panel.items(): + %for val in toolbox.tool_panel_contents( trans ): %if isinstance( val, Tool ): %elif isinstance( val, ToolSection ): diff --git a/templates/webapps/galaxy/workflow/editor.mako b/templates/webapps/galaxy/workflow/editor.mako index d50d4a27b1e..e4de18ee64f 100644 --- a/templates/webapps/galaxy/workflow/editor.mako +++ b/templates/webapps/galaxy/workflow/editor.mako @@ -284,7 +284,7 @@
- %for key, val in app.toolbox.tool_panel.items(): + %for val in app.toolbox.tool_panel_contents( trans ):
%if isinstance( val, Tool ): ${render_tool( val, False )}