Fixes for Galaxy / tool shed communication.

This commit is contained in:
Greg Von Kuster
2011-11-22 17:09:14 -05:00
parent cf4dbf7f6a
commit c5ea1aaa43
2 changed files with 15 additions and 19 deletions
+8 -8
View File
@@ -774,21 +774,21 @@ class AdminGalaxy( BaseUIController, Admin, AdminActions, UsesQuota, QuotaParamP
@web.require_admin
def find_tools_in_tool_shed( self, trans, **kwd ):
tool_shed_url = kwd[ 'tool_shed_url' ]
galaxy_url = trans.request.host
galaxy_url = url_for( '', qualified=True )
url = '%s/repository/find_tools?galaxy_url=%s&webapp=galaxy' % ( tool_shed_url, galaxy_url )
return trans.response.send_redirect( url )
@web.expose
@web.require_admin
def find_workflows_in_tool_shed( self, trans, **kwd ):
tool_shed_url = kwd[ 'tool_shed_url' ]
galaxy_url = trans.request.host
galaxy_url = url_for( '', qualified=True )
url = '%s/repository/find_workflows?galaxy_url=%s&webapp=galaxy' % ( tool_shed_url, galaxy_url )
return trans.response.send_redirect( url )
@web.expose
@web.require_admin
def browse_tool_shed( self, trans, **kwd ):
tool_shed_url = kwd[ 'tool_shed_url' ]
galaxy_url = trans.request.host
galaxy_url = url_for( '', qualified=True )
url = '%s/repository/browse_valid_repositories?galaxy_url=%s&webapp=galaxy' % ( tool_shed_url, galaxy_url )
return trans.response.send_redirect( url )
@web.expose
@@ -986,11 +986,10 @@ class AdminGalaxy( BaseUIController, Admin, AdminActions, UsesQuota, QuotaParamP
@web.expose
@web.require_admin
def check_for_updates( self, trans, **kwd ):
params = util.Params( kwd )
repository = get_repository( trans, kwd[ 'id' ] )
galaxy_url = trans.request.host
galaxy_url = url_for( '', qualified=True )
# Send a request to the relevant tool shed to see if there are any updates.
# TODO: support https in the following url.
# 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 )
return trans.response.send_redirect( url )
@@ -1215,7 +1214,7 @@ class AdminGalaxy( BaseUIController, Admin, AdminActions, UsesQuota, QuotaParamP
module = __import__( import_module )
sys.path.pop( 0 )
except Exception, e:
log.debug( "Execption importing datatypes code file included in installed repository: %s" % str( e ) )
log.debug( "Exception importing datatypes code file included in installed repository: %s" % str( e ) )
trans.app.datatypes_registry = galaxy.datatypes.registry.Registry( trans.app.config.root, datatypes_config )
def __get_repository_tools_and_sample_files( self, trans, tool_path, repo_files_dir ):
# The sample_files list contains all files whose name ends in .sample
@@ -1398,10 +1397,11 @@ def get_repository_by_name_owner_changeset_revision( trans, name, owner, changes
trans.model.ToolShedRepository.table.c.changeset_revision == changeset_revision ) ) \
.first()
def get_repository_by_shed_name_owner_changeset_revision( trans, tool_shed, name, owner, changeset_revision ):
if tool_shed.find( '//' ) > 0:
tool_shed = tool_shed.split( '//' )[1]
return trans.sa_session.query( trans.model.ToolShedRepository ) \
.filter( and_( trans.model.ToolShedRepository.table.c.tool_shed == tool_shed,
trans.model.ToolShedRepository.table.c.name == name,
trans.model.ToolShedRepository.table.c.owner == owner,
trans.model.ToolShedRepository.table.c.changeset_revision == changeset_revision ) ) \
.first()
@@ -437,9 +437,8 @@ class RepositoryController( BaseUIController, ItemRatings ):
if operation == "install":
galaxy_url = trans.get_cookie( name='toolshedgalaxyurl' )
encoded_repo_info_dict = self.__encode_repo_info_dict( trans, webapp, util.listify( item_id ) )
# TODO: support https in the following url.
url = 'http://%s/admin/install_tool_shed_repository?tool_shed_url=%s&webapp=%s&repo_info_dict=%s' % \
( galaxy_url, trans.request.host, webapp, encoded_repo_info_dict )
url = '%s/admin/install_tool_shed_repository?tool_shed_url=%s&webapp=%s&repo_info_dict=%s' % \
( galaxy_url, url_for( '', qualified=True ), webapp, encoded_repo_info_dict )
return trans.response.send_redirect( url )
else:
# This can only occur when there is a multi-select grid with check boxes and an operation,
@@ -514,9 +513,8 @@ class RepositoryController( BaseUIController, ItemRatings ):
if operation == "install":
galaxy_url = trans.get_cookie( name='toolshedgalaxyurl' )
encoded_repo_info_dict = self.__encode_repo_info_dict( trans, webapp, util.listify( item_id ) )
# TODO: support https in the following url.
url = 'http://%s/admin/install_tool_shed_repository?tool_shed_url=%s&webapp=%s&repo_info_dict=%s' % \
( galaxy_url, trans.request.host, webapp, encoded_repo_info_dict )
url = '%s/admin/install_tool_shed_repository?tool_shed_url=%s&webapp=%s&repo_info_dict=%s' % \
( galaxy_url, url_for( '', qualified=True ), webapp, encoded_repo_info_dict )
return trans.response.send_redirect( url )
else:
# This can only occur when there is a multi-select grid with check boxes and an operation,
@@ -761,9 +759,8 @@ class RepositoryController( BaseUIController, ItemRatings ):
repo_info_dict[ repository.name ] = ( repository.description, repository_clone_url, changeset_revision )
encoded_repo_info_dict = encode( repo_info_dict )
# Redirect back to local Galaxy to perform install.
# TODO: support https in the following url.
url = 'http://%s/admin/install_tool_shed_repository?tool_shed_url=%s&repo_info_dict=%s' % \
( galaxy_url, trans.request.host, encoded_repo_info_dict )
url = '%s/admin/install_tool_shed_repository?tool_shed_url=%s&repo_info_dict=%s' % \
( galaxy_url, url_for( '', qualified=True ), encoded_repo_info_dict )
return trans.response.send_redirect( url )
@web.expose
def check_for_updates( self, trans, **kwd ):
@@ -776,8 +773,7 @@ class RepositoryController( BaseUIController, ItemRatings ):
changeset_revision = params.get( 'changeset_revision', None )
webapp = params.get( 'webapp', 'community' )
# Start building up the url to redirect back to the calling Galaxy instance.
# TODO: support https in the following url.
url = 'http://%s/admin/update_to_changeset_revision?tool_shed_url=%s' % ( galaxy_url, trans.request.host )
url = '%s/admin/update_to_changeset_revision?tool_shed_url=%s' % ( galaxy_url, url_for( '', qualified=True ) )
repository = get_repository_by_name_and_owner( trans, name, owner )
url += '&name=%s&owner=%s&changeset_revision=%s&latest_changeset_revision=' % \
( repository.name, repository.user.username, changeset_revision )