Skip to content

Commit

Permalink
Join/load: replace strings with attrs (toolshed-related)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Jan 20, 2023
1 parent 6e28e19 commit 96b8ef6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/tool_shed/webapp/api/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
BaseAPIController,
HTTPBadRequest,
)
from tool_shed.webapp import model
from tool_shed.dependencies import attribute_handlers
from tool_shed.metadata import repository_metadata_manager
from tool_shed.repository_types import util as rt_util
Expand Down Expand Up @@ -118,7 +119,7 @@ def get_ordered_installable_revisions(self, trans, name=None, owner=None, **kwd)
if owner is None:
owner = kwd.get("owner", None)
tsr_id = kwd.get("tsr_id", None)
eagerload_columns = ["downloadable_revisions"]
eagerload_columns = [model.Repository.downloadable_revisions]
if None not in [name, owner]:
# Get the repository information.
repository = repository_util.get_repository_by_name_and_owner(
Expand Down Expand Up @@ -217,7 +218,7 @@ def get_repository_revision_install_info(self, trans, name, owner, changeset_rev
if name and owner and changeset_revision:
# Get the repository information.
repository = repository_util.get_repository_by_name_and_owner(
self.app, name, owner, eagerload_columns=["downloadable_revisions"]
self.app, name, owner, eagerload_columns=[model.Repository.downloadable_revisions]
)
if repository is None:
log.debug(f"Cannot locate repository {name} owned by {owner}")
Expand Down Expand Up @@ -284,7 +285,7 @@ def get_installable_revisions(self, trans, **kwd):
tsr_id = kwd.get("tsr_id", None)
if tsr_id is not None:
repository = repository_util.get_repository_in_tool_shed(
self.app, tsr_id, eagerload_columns=["downloadable_revisions"]
self.app, tsr_id, eagerload_columns=[model.Repository.downloadable_revisions]
)
else:
error_message = "Error in the Tool Shed repositories API in get_ordered_installable_revisions: "
Expand Down Expand Up @@ -737,7 +738,7 @@ def updates(self, trans, **kwd):
changeset_revision = kwd.get("changeset_revision", None)
hexlify_this = util.asbool(kwd.get("hexlify", True))
repository = repository_util.get_repository_by_name_and_owner(
trans.app, name, owner, eagerload_columns=["downloadable_revisions"]
trans.app, name, owner, eagerload_columns=[model.Repository.downloadable_revisions]
)
if repository and repository.downloadable_revisions:
repository_metadata = metadata_util.get_repository_metadata_by_changeset_revision(
Expand Down Expand Up @@ -837,7 +838,7 @@ def metadata(self, trans, id, **kwd):
downloadable_only = util.asbool(kwd.get("downloadable_only", "True"))
all_metadata = {}
repository = repository_util.get_repository_in_tool_shed(
self.app, id, eagerload_columns=["downloadable_revisions"]
self.app, id, eagerload_columns=[model.Repository.downloadable_revisions]
)
for changeset, changehash in metadata_util.get_metadata_revisions(
self.app, repository, sort_revisions=True, downloadable=downloadable_only
Expand Down

0 comments on commit 96b8ef6

Please sign in to comment.