commit/galaxy-central: greg: Make sure a tool shed repository has metadata before setting versions for contained tools.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/86d9c5ddbafc/ changeset: 86d9c5ddbafc user: greg date: 2012-02-03 21:29:02 summary: Make sure a tool shed repository has metadata before setting versions for contained tools. affected #: 2 files diff -r e6464387ed3fce7f235cf5c9af1281da14a32811 -r 86d9c5ddbafc3f54acd8398cf3f3d9c10a5ca54c lib/galaxy/webapps/community/controllers/common.py --- a/lib/galaxy/webapps/community/controllers/common.py +++ b/lib/galaxy/webapps/community/controllers/common.py @@ -559,23 +559,25 @@ for index, changeset_revision in enumerate( changeset_revisions ): tool_versions_dict = {} repository_metadata = get_repository_metadata_by_changeset_revision( trans, id, changeset_revision ) - metadata = repository_metadata.metadata - tool_dicts = metadata.get( 'tools', [] ) - if index == 0: - # The first changset_revision is a special case because it will have no ancestor - # changeset_revisions in which to match tools. The parent tool id for tools in - # the first changeset_revision will be the "old_id" in the tool config. - for tool_dict in tool_dicts: - tool_versions_dict[ tool_dict[ 'guid' ] ] = tool_dict[ 'id' ] - else: - for tool_dict in tool_dicts: - # We have at least 2 changeset revisions to compare tool guids and tool ids. - parent_id = get_parent_id( trans, id, tool_dict[ 'id' ], tool_dict[ 'version' ], tool_dict[ 'guid' ], changeset_revisions[ 0:index ] ) - tool_versions_dict[ tool_dict[ 'guid' ] ] = parent_id - if tool_versions_dict: - repository_metadata.tool_versions = tool_versions_dict - trans.sa_session.add( repository_metadata ) - trans.sa_session.flush() + if repository_metadata: + metadata = repository_metadata.metadata + if metadata: + tool_dicts = metadata.get( 'tools', [] ) + if index == 0: + # The first changset_revision is a special case because it will have no ancestor + # changeset_revisions in which to match tools. The parent tool id for tools in + # the first changeset_revision will be the "old_id" in the tool config. + for tool_dict in tool_dicts: + tool_versions_dict[ tool_dict[ 'guid' ] ] = tool_dict[ 'id' ] + else: + for tool_dict in tool_dicts: + # We have at least 2 changeset revisions to compare tool guids and tool ids. + parent_id = get_parent_id( trans, id, tool_dict[ 'id' ], tool_dict[ 'version' ], tool_dict[ 'guid' ], changeset_revisions[ 0:index ] ) + tool_versions_dict[ tool_dict[ 'guid' ] ] = parent_id + if tool_versions_dict: + repository_metadata.tool_versions = tool_versions_dict + trans.sa_session.add( repository_metadata ) + trans.sa_session.flush() def get_parent_id( trans, id, old_id, version, guid, changeset_revisions ): parent_id = None # Compare from most recent to oldest. diff -r e6464387ed3fce7f235cf5c9af1281da14a32811 -r 86d9c5ddbafc3f54acd8398cf3f3d9c10a5ca54c lib/galaxy/webapps/community/model/migrate/versions/0011_add_tool_versions_column.py --- a/lib/galaxy/webapps/community/model/migrate/versions/0011_add_tool_versions_column.py +++ b/lib/galaxy/webapps/community/model/migrate/versions/0011_add_tool_versions_column.py @@ -1,5 +1,5 @@ """ -Migration script to add the new_repo_alert column to the galaxy_user table. +Migration script to add the tool_versions column to the repository_metadata table. """ from sqlalchemy import * 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)
-
Bitbucket