From 47361f12ecaad83d5d563be763320ae1b17edc3b Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Mon, 14 Dec 2015 12:03:57 +0000 Subject: [PATCH] Reduce code duplication by reusing get_installed_repository() function. Conflicts: lib/galaxy/tools/toolbox/base.py --- lib/galaxy/tools/__init__.py | 16 +++++++--------- lib/galaxy/tools/toolbox/base.py | 1 - 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 189bb3b7cba..1fdf673ea1a 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -18,7 +18,6 @@ from cgi import FieldStorage from xml.etree import ElementTree from mako.template import Template from paste import httpexceptions -from sqlalchemy import and_ from galaxy import model from galaxy.managers import histories @@ -194,14 +193,13 @@ class ToolBox( BaseGalaxyToolBox ): # Abstract toolbox doesn't have a dependency on the the database, so # override _get_tool_shed_repository here to provide this information. - # We store only the port, if one exists, in the database. - tool_shed = common_util.remove_protocol_from_tool_shed_url( tool_shed ) - return self.app.install_model.context.query( self.app.install_model.ToolShedRepository ) \ - .filter( and_( self.app.install_model.ToolShedRepository.table.c.tool_shed == tool_shed, - self.app.install_model.ToolShedRepository.table.c.name == name, - self.app.install_model.ToolShedRepository.table.c.owner == owner, - self.app.install_model.ToolShedRepository.table.c.installed_changeset_revision == installed_changeset_revision ) ) \ - .first() + return suc.get_installed_repository( + self.app, + tool_shed=tool_shed, + name=name, + owner=owner, + installed_changeset_revision=installed_changeset_revision + ) def __build_tool_version_select_field( self, tools, tool_id, set_selected ): """Build a SelectField whose options are the ids for the received list of tools.""" diff --git a/lib/galaxy/tools/toolbox/base.py b/lib/galaxy/tools/toolbox/base.py index 098874d3dd7..01ef6377938 100644 --- a/lib/galaxy/tools/toolbox/base.py +++ b/lib/galaxy/tools/toolbox/base.py @@ -560,7 +560,6 @@ class AbstractToolBox( Dictifiable, ManagesIntegratedToolPanelMixin, object ): repository_name, repository_owner, installed_changeset_revision ) - if tool_shed_repository: # Only load tools if the repository is not deactivated or uninstalled. can_load_into_panel_dict = not tool_shed_repository.deleted