commit/galaxy-central: greg: Eliminate the use of trans in the tool shed's search_util.py module.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/027d160ca90a/ Changeset: 027d160ca90a User: greg Date: 2014-07-17 21:46:42 Summary: Eliminate the use of trans in the tool shed's search_util.py module. Affected #: 2 files diff -r f65eb16fdf1e0b7a6f3483373c32765107c3b2b6 -r 027d160ca90a264d1208184488479ec68e999b5d lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -1347,7 +1347,7 @@ match_tuples = [] ok = True if tool_ids or tool_names or tool_versions: - ok, match_tuples = search_util.search_repository_metadata( trans, + ok, match_tuples = search_util.search_repository_metadata( trans.app, exact_matches_checked, tool_ids=tool_ids, tool_names=tool_names, @@ -1437,9 +1437,14 @@ match_tuples = [] ok = True if workflow_names: - ok, match_tuples = search_util.search_repository_metadata( trans, exact_matches_checked, workflow_names=workflow_names ) + ok, match_tuples = search_util.search_repository_metadata( trans.app, + exact_matches_checked, + workflow_names=workflow_names ) else: - ok, match_tuples = search_util.search_repository_metadata( trans, exact_matches_checked, workflow_names=[], all_workflows=True ) + ok, match_tuples = search_util.search_repository_metadata( trans.app, + exact_matches_checked, + workflow_names=[], + all_workflows=True ) if ok: kwd[ 'match_tuples' ] = match_tuples if trans.webapp.name == 'galaxy': diff -r f65eb16fdf1e0b7a6f3483373c32765107c3b2b6 -r 027d160ca90a264d1208184488479ec68e999b5d lib/tool_shed/util/search_util.py --- a/lib/tool_shed/util/search_util.py +++ b/lib/tool_shed/util/search_util.py @@ -81,15 +81,17 @@ match_tuples.append( ( repository_metadata.repository_id, repository_metadata.changeset_revision ) ) return match_tuples -def search_repository_metadata( trans, exact_matches_checked, tool_ids='', tool_names='', tool_versions='', workflow_names='', all_workflows=False ): +def search_repository_metadata( app, exact_matches_checked, tool_ids='', tool_names='', tool_versions='', + workflow_names='', all_workflows=False ): + sa_session=app.model.context.current match_tuples = [] ok = True if tool_ids or tool_names or tool_versions: - for repository_metadata in trans.sa_session.query( trans.model.RepositoryMetadata ) \ - .filter( trans.model.RepositoryMetadata.table.c.includes_tools == True ) \ - .join( trans.model.Repository ) \ - .filter( and_( trans.model.Repository.table.c.deleted == False, - trans.model.Repository.table.c.deprecated == False ) ): + for repository_metadata in sa_session.query( app.model.RepositoryMetadata ) \ + .filter( app.model.RepositoryMetadata.table.c.includes_tools == True ) \ + .join( app.model.Repository ) \ + .filter( and_( app.model.Repository.table.c.deleted == False, + app.model.Repository.table.c.deprecated == False ) ): metadata = repository_metadata.metadata if metadata: tools = metadata.get( 'tools', [] ) @@ -140,11 +142,11 @@ else: ok = False elif workflow_names or all_workflows: - for repository_metadata in trans.sa_session.query( trans.model.RepositoryMetadata ) \ - .filter( trans.model.RepositoryMetadata.table.c.includes_workflows == True ) \ - .join( trans.model.Repository ) \ - .filter( and_( trans.model.Repository.table.c.deleted == False, - trans.model.Repository.table.c.deprecated == False ) ): + for repository_metadata in sa_session.query( app.model.RepositoryMetadata ) \ + .filter( app.model.RepositoryMetadata.table.c.includes_workflows == True ) \ + .join( app.model.Repository ) \ + .filter( and_( app.model.Repository.table.c.deleted == False, + app.model.Repository.table.c.deprecated == False ) ): metadata = repository_metadata.metadata if metadata: # metadata[ 'workflows' ] is a list of tuples where each contained tuple is Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org