Skip to content

Commit

Permalink
Do not load recursive metadata in the category browser.
Browse files Browse the repository at this point in the history
  • Loading branch information
davebx committed Feb 23, 2016
1 parent dc7f048 commit 63d61b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py
Expand Up @@ -223,11 +223,13 @@ def browse_tool_shed_category( self, trans, **kwd ):
tool_shed_url = kwd.get( 'tool_shed_url', '' )
category_id = kwd.get( 'category_id', '' )
url = common_util.url_join( tool_shed_url )
log.debug( url )
json_data = json.loads( common_util.tool_shed_get( trans.app, url, pathspec=[ 'api', 'categories', category_id, 'repositories' ] ) )
for idx, repository in enumerate( json_data[ 'repositories' ] ):
try:
metadata = json.loads( common_util.tool_shed_get( trans.app, url, pathspec=[ 'api', 'repositories', repository[ 'id' ], 'metadata' ] ) )
metadata = json.loads( common_util.tool_shed_get( trans.app,
url,
pathspec=[ 'api', 'repositories', repository[ 'id' ], 'metadata' ],
params=dict( recursive=False ) ) )
json_data[ 'repositories' ][ idx ][ 'metadata' ] = metadata
except:
json_data[ 'repositories' ][ idx ][ 'metadata' ] = { 'tools_functionally_correct': True }
Expand Down
7 changes: 4 additions & 3 deletions lib/galaxy/webapps/tool_shed/api/repositories.py
Expand Up @@ -763,6 +763,7 @@ def metadata( self, trans, id, **kwd ):
trans.security.decode_id( id )
except Exception:
raise MalformedId( 'The given id is invalid.' )
recursive = util.asbool( kwd.get( 'recursive', 'True' ) )
all_metadata = {}
repository = suc.get_repository_in_tool_shed( self.app, id )
for changeset, changehash in repository.installable_revisions( self.app ):
Expand All @@ -771,15 +772,15 @@ def metadata( self, trans, id, **kwd ):
continue
metadata_dict = metadata.to_dict( value_mapper={ 'id': self.app.security.encode_id, 'repository_id': self.app.security.encode_id } )
metadata_dict[ 'repository' ] = repository.to_dict( value_mapper={ 'id': self.app.security.encode_id } )
if metadata.has_repository_dependencies:
if metadata.has_repository_dependencies and recursive:
metadata_dict[ 'repository_dependencies' ] = metadata_util.get_all_dependencies( self.app, metadata, processed_dependency_links=[] )
else:
metadata_dict[ 'repository_dependencies' ] = []
if metadata.includes_tool_dependencies:
if metadata.includes_tool_dependencies and recursive:
metadata_dict[ 'tool_dependencies' ] = repository.get_tool_dependencies( changehash )
else:
metadata_dict[ 'tool_dependencies' ] = {}
all_metadata[ '%s:%s' % ( changeset, changehash ) ] = metadata_dict
all_metadata[ '%s:%s' % ( int( changeset ), changehash ) ] = metadata_dict
return all_metadata

@expose_api
Expand Down

0 comments on commit 63d61b1

Please sign in to comment.