commit/galaxy-central: greg: If installing a single tool shed repository that contains a readme file, display its contents on the tool panel section selection page.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/41aa295fa871/ changeset: 41aa295fa871 user: greg date: 2012-04-02 17:25:46 summary: If installing a single tool shed repository that contains a readme file, display its contents on the tool panel section selection page. affected #: 4 files diff -r e8e6bb539b85533d8aff54adbacfcfd548ba8a8e -r 41aa295fa871ef7f81f12a701ec59acc16c3ae9c lib/galaxy/web/controllers/admin_toolshed.py --- a/lib/galaxy/web/controllers/admin_toolshed.py +++ b/lib/galaxy/web/controllers/admin_toolshed.py @@ -367,6 +367,22 @@ shed_tool_conf = shed_tool_conf.replace( './', '', 1 ) shed_tool_conf_select_field = None tool_panel_section_select_field = build_tool_panel_section_select_field( trans ) + if includes_tools: + # If we're installing a single repository that contains a readme file, get it's contents to display. + decoded_repo_info_dict = tool_shed_decode( repo_info_dict ) + if len( decoded_repo_info_dict ) == 1: + name = decoded_repo_info_dict.keys()[ 0 ] + repo_info_tuple = decoded_repo_info_dict[ name ] + description, repository_clone_url, changeset_revision = repo_info_tuple + owner = get_repository_owner( clean_repository_clone_url( repository_clone_url ) ) + url = '%s/repository/get_readme?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy' % ( tool_shed_url, name, owner, changeset_revision ) + response = urllib2.urlopen( url ) + readme_text = response.read() + response.close() + else: + readme_text = '' + else: + readme_text = '' return trans.fill_template( '/admin/tool_shed_repository/select_tool_panel_section.mako', tool_shed_url=tool_shed_url, repo_info_dict=repo_info_dict, @@ -375,6 +391,7 @@ shed_tool_conf_select_field=shed_tool_conf_select_field, tool_panel_section_select_field=tool_panel_section_select_field, new_tool_panel_section=new_tool_panel_section, + readme_text=readme_text, message=message, status=status ) @web.expose diff -r e8e6bb539b85533d8aff54adbacfcfd548ba8a8e -r 41aa295fa871ef7f81f12a701ec59acc16c3ae9c lib/galaxy/webapps/community/config.py --- a/lib/galaxy/webapps/community/config.py +++ b/lib/galaxy/webapps/community/config.py @@ -86,6 +86,7 @@ self.cloud_controller_instance = False self.server_name = '' self.job_manager = '' + self.default_job_handlers = [] self.job_handlers = [] self.tool_handlers = [] self.tool_runners = [] diff -r e8e6bb539b85533d8aff54adbacfcfd548ba8a8e -r 41aa295fa871ef7f81f12a701ec59acc16c3ae9c lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -773,6 +773,25 @@ ( galaxy_url, url_for( '/', qualified=True ), encoded_repo_info_dict, str( includes_tools ) ) return trans.response.send_redirect( url ) @web.expose + def get_readme( self, trans, **kwd ): + """ + If the received changeset_revision includes a file named readme (case ignored), return it's contents. + """ + name = kwd[ 'name' ] + owner = kwd[ 'owner' ] + changeset_revision = kwd[ 'changeset_revision' ] + repository = get_repository_by_name_and_owner( trans, name, owner ) + repo_dir = repository.repo_path + repo = hg.repository( get_configured_ui(), repo_dir ) + for root, dirs, files in os.walk( repo_dir ): + for name in files: + if name.lower() in [ 'readme', 'read_me' ]: + f = open( os.path.join( root, name ), 'r' ) + text = f.read() + f.close() + return str( text ) + return '' + @web.expose def get_tool_versions( self, trans, **kwd ): """ For each valid /downloadable change set (up to the received changeset_revision) in the diff -r e8e6bb539b85533d8aff54adbacfcfd548ba8a8e -r 41aa295fa871ef7f81f12a701ec59acc16c3ae9c templates/admin/tool_shed_repository/select_tool_panel_section.mako --- a/templates/admin/tool_shed_repository/select_tool_panel_section.mako +++ b/templates/admin/tool_shed_repository/select_tool_panel_section.mako @@ -62,3 +62,13 @@ </form></div></div> +%if readme_text: + <div class="toolForm"> + <div class="toolFormTitle">Repository README file (may contain important installation or license information)</div> + <div class="toolFormBody"> + <div class="form-row"> + <pre>${readme_text}</pre> + </div> + </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)
-
Bitbucket