commit/galaxy-central: greg: Fix for rendering multiple readme files contained within a tool shed repository.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/872e942b497b/ Changeset: 872e942b497b User: greg Date: 2013-09-25 21:15:41 Summary: Fix for rendering multiple readme files contained within a tool shed repository. Affected #: 6 files diff -r b8d8f81bed872e58b4691643de8a08fa41662e71 -r 872e942b497b22e30d73aada6df101bbef1a460f lib/galaxy/webapps/tool_shed/api/repositories.py --- a/lib/galaxy/webapps/tool_shed/api/repositories.py +++ b/lib/galaxy/webapps/tool_shed/api/repositories.py @@ -1,16 +1,17 @@ import logging from galaxy.web.framework.helpers import time_ago +from galaxy import eggs from galaxy import web from galaxy import util from galaxy.web.base.controller import BaseAPIController import tool_shed.util.shed_util_common as suc from tool_shed.galaxy_install import repository_util -from galaxy import eggs -import pkg_resources +eggs.require( 'mercurial' ) -pkg_resources.require( 'mercurial' ) -from mercurial import hg, ui, commands +from mercurial import commands +from mercurial import hg +from mercurial import ui log = logging.getLogger( __name__ ) diff -r b8d8f81bed872e58b4691643de8a08fa41662e71 -r 872e942b497b22e30d73aada6df101bbef1a460f lib/tool_shed/grids/admin_grids.py --- a/lib/tool_shed/grids/admin_grids.py +++ b/lib/tool_shed/grids/admin_grids.py @@ -1,15 +1,19 @@ -import os, logging -from galaxy.web.framework.helpers import time_ago, grids +import logging +import os +from galaxy.web.framework.helpers import grids +from galaxy.web.framework.helpers import time_ago from galaxy.webapps.tool_shed import model from galaxy.model.orm import and_ import tool_shed.util.shed_util_common as suc -from tool_shed.grids.repository_grids import RepositoryGrid, CategoryGrid +from tool_shed.grids.repository_grids import CategoryGrid +from tool_shed.grids.repository_grids import RepositoryGrid from galaxy import eggs -import pkg_resources +eggs.require( 'mercurial' ) -pkg_resources.require( 'mercurial' ) -from mercurial import hg, ui, commands +from mercurial import commands +from mercurial import hg +from mercurial import ui log = logging.getLogger( __name__ ) diff -r b8d8f81bed872e58b4691643de8a08fa41662e71 -r 872e942b497b22e30d73aada6df101bbef1a460f lib/tool_shed/util/container_util.py --- a/lib/tool_shed/util/container_util.py +++ b/lib/tool_shed/util/container_util.py @@ -573,27 +573,23 @@ def build_readme_files_folder( trans, folder_id, readme_files_dict, label='Readme files' ): """Return a folder hierarchy containing readme text files.""" if readme_files_dict: - multiple_readme_files = len( readme_files_dict ) > 1 readme_id = 0 folder_id += 1 readme_files_root_folder = Folder( id=folder_id, key='root', label='root', parent=None ) - if multiple_readme_files: - folder_id += 1 - readme_files_folder = Folder( id=folder_id, key='readme_files', label=label, parent=readme_files_root_folder ) - readme_files_root_folder.folders.append( readme_files_folder ) + folder_id += 1 + readme_files_folder = Folder( id=folder_id, key='readme_files', label=label, parent=readme_files_root_folder ) + multiple_readme_files = len( readme_files_dict ) > 1 + readme_files_root_folder.folders.append( readme_files_folder ) for readme_file_name, readme_file_text in readme_files_dict.items(): readme_id += 1 readme = ReadMe( id=readme_id, name=readme_file_name, text=readme_file_text ) if multiple_readme_files: folder_id += 1 - folder = Folder( id=folder_id, key=readme.name, label=readme.name, parent=readme_files_folder ) + folder = Folder( id=folder_id, key=readme_file_name, label=readme_file_name, parent=readme_files_folder ) folder.readme_files.append( readme ) readme_files_folder.folders.append( folder ) else: - folder_id += 1 - readme_files_folder = Folder( id=folder_id, key='readme_files', label=readme.name, parent=readme_files_root_folder ) readme_files_folder.readme_files.append( readme ) - readme_files_root_folder.folders.append( readme_files_folder ) else: readme_files_root_folder = None return folder_id, readme_files_root_folder diff -r b8d8f81bed872e58b4691643de8a08fa41662e71 -r 872e942b497b22e30d73aada6df101bbef1a460f lib/tool_shed/util/metadata_util.py --- a/lib/tool_shed/util/metadata_util.py +++ b/lib/tool_shed/util/metadata_util.py @@ -589,7 +589,7 @@ original_repository_metadata = repository.metadata else: original_repository_metadata = None - readme_file_names = get_readme_file_names( repository.name ) + readme_file_names = readme_util.get_readme_file_names( str( repository.name ) ) if app.name == 'galaxy': # Shed related tool panel configs are only relevant to Galaxy. metadata_dict = { 'shed_config_filename' : shed_config_dict.get( 'config_filename' ) } @@ -1046,16 +1046,6 @@ # The tool did not change through all of the changeset revisions. return old_id -def get_readme_file_names( repository_name ): - """Creates a list of valid filenames.""" - readme_files = [ 'readme', 'read_me', 'install' ] - valid_filenames = map( lambda f: '%s.txt' % f, readme_files ) - valid_filenames.extend( map( lambda f: '%s.rst' % f, readme_files ) ) - valid_filenames.extend( readme_files ) - valid_filenames.append( '%s.txt' % repository_name ) - valid_filenames.append( '%s.rst' % repository_name ) - return valid_filenames - def get_relative_path_to_repository_file( root, name, relative_install_dir, work_dir, shed_config_dict, resetting_all_metadata_on_repository ): if resetting_all_metadata_on_repository: full_path_to_file = os.path.join( root, name ) diff -r b8d8f81bed872e58b4691643de8a08fa41662e71 -r 872e942b497b22e30d73aada6df101bbef1a460f lib/tool_shed/util/readme_util.py --- a/lib/tool_shed/util/readme_util.py +++ b/lib/tool_shed/util/readme_util.py @@ -70,3 +70,13 @@ raw_text = common_util.tool_shed_get( trans.app, tool_shed_url, url ) readme_files_dict = json.from_json_string( raw_text ) return readme_files_dict + +def get_readme_file_names( repository_name ): + """Return a list of file names that will be categorized as README files for the received repository_name.""" + readme_files = [ 'readme', 'read_me', 'install' ] + valid_filenames = map( lambda f: '%s.txt' % f, readme_files ) + valid_filenames.extend( map( lambda f: '%s.rst' % f, readme_files ) ) + valid_filenames.extend( readme_files ) + valid_filenames.append( '%s.txt' % repository_name ) + valid_filenames.append( '%s.rst' % repository_name ) + return valid_filenames diff -r b8d8f81bed872e58b4691643de8a08fa41662e71 -r 872e942b497b22e30d73aada6df101bbef1a460f templates/webapps/tool_shed/repository/common.mako --- a/templates/webapps/tool_shed/repository/common.mako +++ b/templates/webapps/tool_shed/repository/common.mako @@ -425,7 +425,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rd-${encoded_id}"><${cell_type} style="padding-left: ${pad+20}px;">${datatype.extension | h}</${cell_type}><${cell_type}>${datatype.type | h}</${cell_type}><${cell_type}>${datatype.mimetype | h}</${cell_type}> @@ -446,7 +446,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rft-${encoded_id}"><td style="padding-left: ${pad+20}px;"><table id="failed_test_table" class="tool_test_results"><tr><td bgcolor="#FFFFCC"><b>Tool id:</b> ${failed_test.tool_id | h}</td></tr> @@ -475,7 +475,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-ridm-${encoded_id}"><${cell_type} style="padding-left: ${pad+20}px;">${data_manager.index | h}</${cell_type}><${cell_type}>${data_manager.error | h}</${cell_type}></tr> @@ -493,7 +493,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rird-${encoded_id}"><td style="padding-left: ${pad+20}px;"> ${ invalid_repository_dependency.error | h } </td> @@ -510,7 +510,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rit-${encoded_id}"><td style="padding-left: ${pad+20}px;"> %if trans.webapp.name == 'tool_shed' and invalid_tool.repository_id and invalid_tool.tool_config and invalid_tool.changeset_revision: <a class="view-info" href="${h.url_for( controller='repository', action='load_invalid_tool', repository_id=trans.security.encode_id( invalid_tool.repository_id ), tool_config=invalid_tool.tool_config, changeset_revision=invalid_tool.changeset_revision, render_repository_actions_for=render_repository_actions_for )}"> @@ -545,7 +545,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-ritd-${encoded_id}"><td style="padding-left: ${pad+20}px;"><table id="invalid_td_table"><tr><td>${ invalid_tool_dependency.error | h }</td></tr> @@ -564,7 +564,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rmtc-${encoded_id}"><td style="padding-left: ${pad+20}px;"><table id="missing_table" class="tool_test_results"><tr><td bgcolor="#FFFFCC"><b>Tool id:</b> ${missing_test_component.tool_id | h}</td></tr> @@ -587,27 +587,17 @@ encoded_id = trans.security.encode_id( readme.id ) render_rst = readme.name.endswith( '.rst' ) %> - <style type="text/css"> - #readme_table{ table-layout:fixed; - width:100%; - overflow-wrap:normal; - overflow:hidden; - border:0px; - word-break:keep-all; - word-wrap:break-word; - line-break:strict; } - </style><tr class="datasetRow" %if parent is not None: - parent="${parent}" + parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rr-${encoded_id}"><td style="padding-left: ${pad+20}px;"> - <table id="readme_table"> + <table id="readme_files"> %if render_rst: <tr><td>${ rst_to_html( readme.text ) }</td></tr> %else: - <tr><td>${readme.name}<br/>${ to_html_string( readme.text ) }</td></tr> + <tr><td>${ to_html_string( readme.text ) }</td></tr> %endif </table></td> @@ -652,7 +642,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rrd-${encoded_id}"> %if trans.webapp.name == 'galaxy': <${cell_type} style="padding-left: ${pad+20}px;"> %if row_is_header: @@ -684,6 +674,19 @@ %></%def> +<%def name="render_readme_files_css()"> + <style type="text/css"> + table.readme_files{ table-layout:fixed; + width:100%; + overflow-wrap:normal; + overflow:hidden; + border:0px; + word-break:keep-all; + word-wrap:break-word; + line-break:strict; } + </style> +</%def> + <%def name="render_tool_test_results_css()"><style type="text/css"> table.tool_test_results{ table-layout:fixed; @@ -703,7 +706,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rtdie-${encoded_id}"><td style="padding-left: ${pad+20}px;"><table id="td_install_error_table" class="tool_test_results"><tr bgcolor="#FFFFCC"> @@ -731,7 +734,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rrie-${encoded_id}"><td style="padding-left: ${pad+20}px;"><table id="rd_install_error_table" class="tool_test_results"> %if not is_current_repository: @@ -762,7 +765,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rnt-${encoded_id}"><td style="padding-left: ${pad+20}px;"><table id="not_tested_table" class="tool_test_results"><tr><td>${not_tested.reason | h}</td></tr> @@ -781,7 +784,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rpt-${encoded_id}"><td style="padding-left: ${pad+20}px;"><table id="passed_tests_table" class="tool_test_results"><tr><td bgcolor="#FFFFCC"><b>Tool id:</b> ${passed_test.tool_id | h}</td></tr> @@ -808,7 +811,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rt-${encoded_id}"> %if row_is_header: <th style="padding-left: ${pad+20}px;">${tool.name | h}</th> %else: @@ -857,7 +860,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rtd-${encoded_id}"><${cell_type} style="padding-left: ${pad+20}px;"> %if row_is_header: ${tool_dependency.name | h} @@ -913,13 +916,23 @@ <%def name="render_test_environment( test_environment, pad, parent, row_counter, row_is_header=False )"><% encoded_id = trans.security.encode_id( test_environment.id ) %> + <style type="text/css"> + #test_environment_table{ table-layout:fixed; + width:100%; + overflow-wrap:normal; + overflow:hidden; + border:0px; + word-break:keep-all; + word-wrap:break-word; + line-break:strict; } + </style><tr class="datasetRow" %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rte-${encoded_id}"><td style="padding-left: ${pad+20}px;"> - <table class="grid" id="readme_table"> + <table class="grid" id="test_environment_table"><tr><td><b>Time tested:</b> ${test_environment.time_last_tested | h}</td></tr><tr><td><b>System:</b> ${test_environment.system | h}</td></tr><tr><td><b>Architecture:</b> ${test_environment.architecture | h}</td></tr> @@ -950,7 +963,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rvdm-${encoded_id}"><${cell_type} style="padding-left: ${pad+20}px;">${data_manager.name | h}</${cell_type}><${cell_type}>${data_manager.version | h}</${cell_type}><${cell_type}>${data_manager.data_tables | h}</${cell_type}> @@ -981,7 +994,7 @@ %if parent is not None: parent="${parent}" %endif - id="libraryItem-${encoded_id}"> + id="libraryItem-rw-${encoded_id}"><${cell_type} style="padding-left: ${pad+20}px;"> %if row_is_header: ${workflow.workflow_name | h} @@ -1045,6 +1058,8 @@ return str( self.count ) %> %if readme_files_root_folder: + ${render_readme_files_css()} + <p/><div class="toolForm"><div class="toolFormTitle">Repository README files - may contain important installation or license information</div><div class="toolFormBody"> @@ -1161,11 +1176,11 @@ <div class="toolForm"><div class="toolFormTitle">Automated tool test results</div><div class="toolFormBody"> - <p/> - <% row_counter = RowCounter() %> - <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="test_environment"> - ${render_folder( tool_test_results_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True )} - </table> + <p/> + <% row_counter = RowCounter() %> + <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="test_environment"> + ${render_folder( tool_test_results_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True )} + </table></div></div> %endif 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