commit/galaxy-central: greg: More fixes for Galaxy <-> tool shed communication.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/255f4bde822b/ changeset: 255f4bde822b user: greg date: 2011-11-23 17:24:53 summary: More fixes for Galaxy <-> tool shed communication. affected #: 3 files diff -r af8f5887b97768777be91dab8df40bbcd8b8d3c8 -r 255f4bde822b4b9b36c1a9074cc6063a47127ff2 lib/galaxy/web/controllers/admin.py --- a/lib/galaxy/web/controllers/admin.py +++ b/lib/galaxy/web/controllers/admin.py @@ -986,12 +986,11 @@ @web.expose @web.require_admin def check_for_updates( self, trans, **kwd ): + # Send a request to the relevant tool shed to see if there are any updates. repository = get_repository( trans, kwd[ 'id' ] ) - galaxy_url = url_for( '', qualified=True ) - # Send a request to the relevant tool shed to see if there are any updates. - # TODO: Fix this to use url_for to support locally hosted tool sheds. - url = 'http://%s/repository/check_for_updates?galaxy_url=%s&name=%s&owner=%s&changeset_revision=%s&webapp=galaxy' % \ - ( repository.tool_shed, galaxy_url, repository.name, repository.owner, repository.changeset_revision ) + tool_shed_url = get_url_from_repository_tool_shed( trans, repository ) + url = '%s/repository/check_for_updates?galaxy_url=%s&name=%s&owner=%s&changeset_revision=%s&webapp=galaxy' % \ + ( tool_shed_url, url_for( '', qualified=True ), repository.name, repository.owner, repository.changeset_revision ) return trans.response.send_redirect( url ) @web.expose @web.require_admin @@ -1405,3 +1404,17 @@ trans.model.ToolShedRepository.table.c.owner == owner, trans.model.ToolShedRepository.table.c.changeset_revision == changeset_revision ) ) \ .first() +def get_url_from_repository_tool_shed( trans, repository ): + # The stored value of repository.tool_shed is something like: + # toolshed.g2.bx.psu.edu + # We need the URL to this tool shed, which is something like: + # http://toolshed.g2.bx.psu.edu/ + for shed_name, shed_url in trans.app.tool_shed_registry.tool_sheds.items(): + if shed_url.find( repository.tool_shed ) >= 0: + if shed_url.endswith( '/' ): + shed_url = shed_url.rstrip( '/' ) + return shed_url + # The tool shed from which the repository was originally + # installed must no longer be configured in tool_sheds_conf.xml. + return None + \ No newline at end of file diff -r af8f5887b97768777be91dab8df40bbcd8b8d3c8 -r 255f4bde822b4b9b36c1a9074cc6063a47127ff2 lib/galaxy/web/controllers/workflow.py --- a/lib/galaxy/web/controllers/workflow.py +++ b/lib/galaxy/web/controllers/workflow.py @@ -1125,7 +1125,7 @@ import_button = True if tool_shed_url and not import_button: # Use urllib (send another request to the tool shed) to retrieve the workflow. - workflow_url = 'http://%s/workflow/import_workflow?repository_metadata_id=%s&workflow_name=%s&webapp=%s&open_for_url=true' % \ + workflow_url = '%s/workflow/import_workflow?repository_metadata_id=%s&workflow_name=%s&webapp=%s&open_for_url=true' % \ ( tool_shed_url, repository_metadata_id, tool_shed_encode( workflow_name ), webapp ) response = urllib2.urlopen( workflow_url ) workflow_text = response.read() @@ -1197,7 +1197,7 @@ for shed_name, shed_url in trans.app.tool_shed_registry.tool_sheds.items(): if shed_url.endswith( '/' ): shed_url = shed_url.rstrip( '/' ) - url = '%s/repository/find_tools?galaxy_url=%s&webapp=%s' % ( shed_url, trans.request.host, webapp ) + url = '%s/repository/find_tools?galaxy_url=%s&webapp=%s' % ( shed_url, url_for( '', qualified=True ), webapp ) if missing_tool_tups: url += '&tool_id=' for missing_tool_tup in missing_tool_tups: @@ -1224,8 +1224,7 @@ if tool_shed_url: # We've received the textual representation of a workflow from a Galaxy tool shed. message = "Workflow <b>%s</b> imported successfully." % workflow.name - # TODO: support https in the following url. - url = 'http://%s/workflow/view_workflow?repository_metadata_id=%s&workflow_name=%s&webapp=%s&message=%s' % \ + url = '%s/workflow/view_workflow?repository_metadata_id=%s&workflow_name=%s&webapp=%s&message=%s' % \ ( tool_shed_url, repository_metadata_id, tool_shed_encode( workflow_name ), webapp, message ) return trans.response.send_redirect( url ) elif installed_repository_file: diff -r af8f5887b97768777be91dab8df40bbcd8b8d3c8 -r 255f4bde822b4b9b36c1a9074cc6063a47127ff2 lib/galaxy/webapps/community/controllers/workflow.py --- a/lib/galaxy/webapps/community/controllers/workflow.py +++ b/lib/galaxy/webapps/community/controllers/workflow.py @@ -379,9 +379,8 @@ to_file.write( to_json_string( workflow_data ) ) return open( tmp_fname ) galaxy_url = trans.get_cookie( name='toolshedgalaxyurl' ) - # TODO: support https in the following url. - url = 'http://%s/workflow/import_workflow?tool_shed_url=%s&repository_metadata_id=%s&workflow_name=%s&webapp=%s' % \ - ( galaxy_url, trans.request.host, repository_metadata_id, encode( workflow_name ), webapp ) + url = '%s/workflow/import_workflow?tool_shed_url=%s&repository_metadata_id=%s&workflow_name=%s&webapp=%s' % \ + ( galaxy_url, url_for( '', qualified=True ), repository_metadata_id, encode( workflow_name ), webapp ) return trans.response.send_redirect( url ) return trans.response.send_redirect( web.url_for( controller='workflow', action='view_workflow', 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