commit/galaxy-central: inithello: Fix for displaying an installed repository that includes one or more readme files.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/cfab4734097b/ changeset: cfab4734097b user: inithello date: 2012-12-19 22:48:09 summary: Fix for displaying an installed repository that includes one or more readme files. affected #: 3 files diff -r 759d96f950b8825bcce157cdf5efbabaa0221b11 -r cfab4734097b388776035fdd2741ccf6a370b95c lib/galaxy/util/shed_util_common.py --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -57,13 +57,16 @@ requirements_dict[ 'install_dir' ] = install_dir tool_dependencies[ dependency_key ] = requirements_dict return tool_dependencies -def build_readme_files_dict( metadata ): +def build_readme_files_dict( metadata, tool_path=None ): """Return a dictionary of valid readme file name <-> readme file content pairs for all readme files contained in the received repository_metadata.""" readme_files_dict = {} if metadata and 'readme_files' in metadata: for relative_path_to_readme_file in metadata[ 'readme_files' ]: readme_file_name = os.path.split( relative_path_to_readme_file )[ 1 ] - full_path_to_readme_file = os.path.abspath( relative_path_to_readme_file ) + if tool_path: + full_path_to_readme_file = os.path.abspath( os.path.join( tool_path, relative_path_to_readme_file ) ) + else: + full_path_to_readme_file = os.path.abspath( relative_path_to_readme_file ) try: f = open( full_path_to_readme_file, 'r' ) text = f.read() @@ -103,7 +106,7 @@ containers_dict[ 'invalid_tools' ] = invalid_tools_root_folder # Readme files container. if readme_files_dict: - folder_id, readme_files_root_folder = build_readme_files_folder( folder_id, readme_files_dict ) + folder_id, readme_files_root_folder = container_util.build_readme_files_folder( folder_id, readme_files_dict ) containers_dict[ 'readme_files' ] = readme_files_root_folder # Repository dependencies container. if repository_dependencies: diff -r 759d96f950b8825bcce157cdf5efbabaa0221b11 -r cfab4734097b388776035fdd2741ccf6a370b95c lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -881,7 +881,7 @@ datatypes = metadata.get( 'datatypes', None ) invalid_tools = metadata.get( 'invalid_tools', None ) if repository.has_readme_files: - readme_files_dict = suc.build_readme_files_dict( repository.metadata ) + readme_files_dict = suc.build_readme_files_dict( repository.metadata, tool_path ) else: readme_files_dict = None repository_dependencies = metadata.get( 'repository_dependencies', None ) @@ -1515,17 +1515,19 @@ if repository_dependencies: # We need to add a root_key entry to the repository_dependencies dictionary since it will not be included in the installed tool # shed repository metadata. - root_key = container_util.generate_repository_dependencies_key_for_repository( repository.tool_shed, - repository.name, - repository.owner, - repository.installed_changeset_revision ) + root_key = container_util.generate_repository_dependencies_key_for_repository( tool_shed_repository.tool_shed, + tool_shed_repository.name, + tool_shed_repository.owner, + tool_shed_repository.installed_changeset_revision ) rd_tups_for_display = [] rd_tups = repository_dependencies[ 'repository_dependencies' ] repository_dependencies_dict_for_display[ 'root_key' ] = root_key repository_dependencies_dict_for_display[ root_key ] = rd_tups repository_dependencies_dict_for_display[ 'description' ] = repository_dependencies[ 'description' ] all_tool_dependencies = metadata.get( 'tool_dependencies', None ) - tool_dependencies, missing_tool_dependencies = shed_util.get_installed_and_missing_tool_dependencies( trans, repository, all_tool_dependencies ) + tool_dependencies, missing_tool_dependencies = shed_util.get_installed_and_missing_tool_dependencies( trans, + tool_shed_repository, + all_tool_dependencies ) valid_tools = metadata.get( 'tools', None ) workflows = metadata.get( 'workflows', None ) containers_dict = suc.build_repository_containers_for_galaxy( trans=trans, diff -r 759d96f950b8825bcce157cdf5efbabaa0221b11 -r cfab4734097b388776035fdd2741ccf6a370b95c templates/webapps/community/repository/common.mako --- a/templates/webapps/community/repository/common.mako +++ b/templates/webapps/community/repository/common.mako @@ -388,7 +388,7 @@ <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( tool.repository_id ), changeset_revision=tool.changeset_revision, tool_id=tool.tool_id )}">View tool metadata</a></div> %else: - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='view_tool_metadata', repository_id=trans.security.encode_id( tool.repository_id ), changeset_revision=tool.changeset_revision, tool_id=tool.tool_id )}">View tool metadata</a> + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='view_tool_metadata', repository_id=trans.security.encode_id( tool.repository_id ), changeset_revision=tool.changeset_revision, tool_id=tool.tool_id )}">${tool.name | h}</a> %endif %else: ${tool.name | h} 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