mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
More fixes for Galaxy <-> tool shed communication.
This commit is contained in:
@@ -986,12 +986,11 @@ class AdminGalaxy( BaseUIController, Admin, AdminActions, UsesQuota, QuotaParamP
|
||||
@web.expose
|
||||
@web.require_admin
|
||||
def check_for_updates( self, trans, **kwd ):
|
||||
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 )
|
||||
repository = get_repository( trans, kwd[ 'id' ] )
|
||||
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 @@ def get_repository_by_shed_name_owner_changeset_revision( trans, tool_shed, name
|
||||
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
|
||||
|
||||
@@ -1125,7 +1125,7 @@ class WorkflowController( BaseUIController, Sharable, UsesStoredWorkflow, UsesAn
|
||||
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 @@ class WorkflowController( BaseUIController, Sharable, UsesStoredWorkflow, UsesAn
|
||||
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 @@ class WorkflowController( BaseUIController, Sharable, UsesStoredWorkflow, UsesAn
|
||||
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:
|
||||
|
||||
@@ -379,9 +379,8 @@ class WorkflowController( BaseUIController ):
|
||||
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',
|
||||
|
||||
Reference in New Issue
Block a user