1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/3e43e8c42bc1/
changeset: 3e43e8c42bc1
user: greg
date: 2013-03-21 15:58:11
summary: Move the tool_shed_repository_revision_update.py api example script to ~/lib/tool_shed/scripts/api
affected #: 1 file
diff -r cd766b6391448acae0574fcf240b4cf5c55d340e -r 3e43e8c42bc19eca2532989f83adbc8811062f62 lib/tool_shed/scripts/api/tool_shed_repository_revision_update.py
--- /dev/null
+++ b/lib/tool_shed/scripts/api/tool_shed_repository_revision_update.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+"""
+PUT/update script to update appropriate values in a repository_metadata table record in the Tool Shed.
+
+usage: tool_shed_repository_revision_update.py key url key1=value1 key2=value2 ...
+"""
+
+import os, sys
+sys.path.insert( 0, os.path.dirname( __file__ ) )
+from common import update
+
+import pkg_resources
+pkg_resources.require( "simplejson" )
+
+import simplejson
+
+to_json_string = simplejson.dumps
+from_json_string = simplejson.loads
+
+data = {}
+for key, value in [ kwarg.split( '=', 1 ) for kwarg in sys.argv[ 3: ] ]:
+ """
+ This example script will properly handle updating the value of one or more of the following RepositoryMetadata attributes:
+ tools_functionally_correct, do_not_test, tool_test_errors
+ """
+ if key in [ 'tools_functionally_correct', 'do_not_test' ]:
+ if str( value ).lower() in [ 'true', 'yes', 'on' ]:
+ new_value = True
+ else:
+ new_value = False
+ elif key in [ 'tool_test_errors' ]:
+ new_value = from_json_string( value )
+ else:
+ new_value = str( value )
+ data[ key ] = new_value
+
+update( sys.argv[ 1 ], sys.argv[ 2 ], data )
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/8607202c00cc/
changeset: 8607202c00cc
branch: next-stable
user: inithello
date: 2013-03-20 14:33:34
summary: Display an error message when cookies are blocked between the tool shed and galaxy.
affected #: 2 files
diff -r c92d41cb71440de8564112e6e89a75598388268c -r 8607202c00ccd5ecf6852a348e354b4d77f68d54 lib/galaxy/webapps/tool_shed/controllers/repository.py
--- a/lib/galaxy/webapps/tool_shed/controllers/repository.py
+++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py
@@ -317,9 +317,9 @@
@web.expose
def browse_valid_categories( self, trans, **kwd ):
# The request came from Galaxy, so restrict category links to display only valid repository changeset revisions.
- galaxy_url = kwd.get( 'galaxy_url', None )
+ galaxy_url = suc.handle_galaxy_url( trans, **kwd )
if galaxy_url:
- trans.set_cookie( galaxy_url, name='toolshedgalaxyurl' )
+ kwd[ 'galaxy_url' ] = galaxy_url
if 'f-free-text-search' in kwd:
if kwd[ 'f-free-text-search' ] == 'All':
# The user performed a search, then clicked the "x" to eliminate the search criteria.
@@ -346,11 +346,14 @@
return trans.response.send_redirect( web.url_for( controller='repository',
action='browse_valid_repositories',
**kwd ) )
+ log.debug("CCC In browse_valid_categories, just before returning valid_category_grid, kwd: %s" % str( kwd ))
return self.valid_category_grid( trans, **kwd )
@web.expose
def browse_valid_repositories( self, trans, **kwd ):
- galaxy_url = kwd.get( 'galaxy_url', None )
+ galaxy_url = suc.handle_galaxy_url( trans, **kwd )
+ if galaxy_url:
+ kwd[ 'galaxy_url' ] = galaxy_url
repository_id = kwd.get( 'id', None )
if 'f-free-text-search' in kwd:
if 'f-Category.name' in kwd:
@@ -359,8 +362,6 @@
category = suc.get_category_by_name( trans, category_name )
# Set the id value in kwd since it is required by the ValidRepositoryGrid.build_initial_query method.
kwd[ 'id' ] = trans.security.encode_id( category.id )
- if galaxy_url:
- trans.set_cookie( galaxy_url, name='toolshedgalaxyurl' )
if 'operation' in kwd:
operation = kwd[ 'operation' ].lower()
if operation == "preview_tools_in_changeset":
@@ -423,7 +424,7 @@
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
# If the request originated with the UpdateManager, it will not include a galaxy_url.
- galaxy_url = kwd.get( 'galaxy_url', '' )
+ galaxy_url = suc.handle_galaxy_url( trans, **kwd )
name = params.get( 'name', None )
owner = params.get( 'owner', None )
changeset_revision = params.get( 'changeset_revision', None )
@@ -437,11 +438,14 @@
if from_update_manager:
update = 'true'
no_update = 'false'
- else:
+ elif galaxy_url:
# Start building up the url to redirect back to the calling Galaxy instance.
url = suc.url_join( galaxy_url,
'admin_toolshed/update_to_changeset_revision?tool_shed_url=%s&name=%s&owner=%s&changeset_revision=%s&latest_changeset_revision=' % \
( web.url_for( '/', qualified=True ), repository.name, repository.user.username, changeset_revision ) )
+ else:
+ message = 'Unable to check for updates due to an invalid Galaxy URL: <b>%s</b>. You may need to enable cookies in your browser. ' % galaxy_url
+ return trans.show_error_message( message )
if changeset_revision == repository.tip( trans.app ):
# If changeset_revision is the repository tip, there are no additional updates.
if from_update_manager:
@@ -746,9 +750,7 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- galaxy_url = kwd.get( 'galaxy_url', None )
- if galaxy_url:
- trans.set_cookie( galaxy_url, name='toolshedgalaxyurl' )
+ galaxy_url = suc.handle_galaxy_url( trans, **kwd )
if 'operation' in kwd:
item_id = kwd.get( 'id', '' )
if item_id:
@@ -833,9 +835,7 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- galaxy_url = kwd.get( 'galaxy_url', None )
- if galaxy_url:
- trans.set_cookie( galaxy_url, name='toolshedgalaxyurl' )
+ galaxy_url = suc.handle_galaxy_url( trans, **kwd )
if 'operation' in kwd:
item_id = kwd.get( 'id', '' )
if item_id:
@@ -952,7 +952,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- galaxy_url = kwd.get( 'galaxy_url', '' )
name = params.get( 'name', None )
owner = params.get( 'owner', None )
changeset_revision = params.get( 'changeset_revision', None )
@@ -1443,18 +1442,23 @@
changeset_revisions = kwd.get( 'changeset_revisions', None )
name = kwd.get( 'name', None )
owner = kwd.get( 'owner', None )
- galaxy_url = kwd.get( 'galaxy_url', None )
if not repository_ids:
repository = suc.get_repository_by_name_and_owner( trans.app, name, owner )
repository_ids = trans.security.encode_id( repository.id )
- if not galaxy_url:
- # If galaxy_url is not in the request, it had to have been stored in a cookie by the tool shed.
- galaxy_url = trans.get_cookie( name='toolshedgalaxyurl' )
- # Redirect back to local Galaxy to perform install.
- url = suc.url_join( galaxy_url,
- 'admin_toolshed/prepare_for_install?tool_shed_url=%s&repository_ids=%s&changeset_revisions=%s' % \
- ( web.url_for( '/', qualified=True ), ','.join( util.listify( repository_ids ) ), ','.join( util.listify( changeset_revisions ) ) ) )
- return trans.response.send_redirect( url )
+ galaxy_url = suc.handle_galaxy_url( trans, **kwd )
+ if galaxy_url:
+ # Redirect back to local Galaxy to perform install.
+ url = suc.url_join( galaxy_url,
+ 'admin_toolshed/prepare_for_install?tool_shed_url=%s&repository_ids=%s&changeset_revisions=%s' % \
+ ( web.url_for( '/', qualified=True ), ','.join( util.listify( repository_ids ) ), ','.join( util.listify( changeset_revisions ) ) ) )
+ return trans.response.send_redirect( url )
+ else:
+ message = 'Repository installation is not possible due to an invalid Galaxy URL: <b>%s</b>. You may need to enable cookies in your browser. ' % galaxy_url
+ status = 'error'
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='browse_valid_categories',
+ message=message,
+ status=status ) )
@web.expose
def load_invalid_tool( self, trans, repository_id, tool_config, changeset_revision, **kwd ):
@@ -1854,8 +1858,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- # If the request originated with the UpdateManager, it will not include a galaxy_url.
- galaxy_url = kwd.get( 'galaxy_url', '' )
name = params.get( 'name', None )
owner = params.get( 'owner', None )
changeset_revision = params.get( 'changeset_revision', None )
diff -r c92d41cb71440de8564112e6e89a75598388268c -r 8607202c00ccd5ecf6852a348e354b4d77f68d54 lib/tool_shed/util/shed_util_common.py
--- a/lib/tool_shed/util/shed_util_common.py
+++ b/lib/tool_shed/util/shed_util_common.py
@@ -116,6 +116,7 @@
return False
def changeset_is_valid( app, repository, changeset_revision ):
+ """Make sure a changeset hash is valid for a specified repository."""
repo = hg.repository( get_configured_ui(), repository.repo_path( app ) )
for changeset in repo.changelog:
changeset_hash = str( repo.changectx( changeset ) )
@@ -124,6 +125,7 @@
return False
def clean_repository_clone_url( repository_clone_url ):
+ """Return a URL that can be used to clone a tool shed repository, eliminating the protocol and user if either exists."""
if repository_clone_url.find( '@' ) > 0:
# We have an url that includes an authenticated user, something like:
# http://test@bx.psu.edu:9009/repos/some_username/column
@@ -139,6 +141,7 @@
return tmp_url
def clean_tool_shed_url( tool_shed_url ):
+ """Return a tool shed URL, eliminating the port if it exists."""
if tool_shed_url.find( ':' ) > 0:
# Eliminate the port, if any, since it will result in an invalid directory name.
return tool_shed_url.split( ':' )[ 0 ]
@@ -186,6 +189,10 @@
def create_or_update_tool_shed_repository( app, name, description, installed_changeset_revision, ctx_rev, repository_clone_url, metadata_dict,
status, current_changeset_revision=None, owner='', dist_to_shed=False ):
+ """
+ Update a tool shed repository record i the Galaxy database with the new information received. If a record defined by the received tool shed, repository name
+ and owner does not exists, create a new record with the received information.
+ """
# The received value for dist_to_shed will be True if the InstallManager is installing a repository that contains tools or datatypes that used
# to be in the Galaxy distribution, but have been moved to the main Galaxy tool shed.
log.debug( "Adding new row (or updating an existing row) for repository '%s' in the tool_shed_repository table." % name )
@@ -272,6 +279,7 @@
return sharable_url
def generate_tool_elem( tool_shed, repository_name, changeset_revision, owner, tool_file_path, tool, tool_section ):
+ """Create and return an ElementTree tool Element."""
if tool_section is not None:
tool_elem = SubElement( tool_section, 'tool' )
else:
@@ -429,6 +437,7 @@
return _ui
def get_ctx_rev( tool_shed_url, name, owner, changeset_revision ):
+ """Send a request to the tool shed to retrieve the ctx_rev for a repository defined by the combination of a name, owner and changeset revision."""
url = url_join( tool_shed_url, 'repository/get_ctx_rev?name=%s&owner=%s&changeset_revision=%s' % ( name, owner, changeset_revision ) )
response = urllib2.urlopen( url )
ctx_rev = response.read()
@@ -448,6 +457,7 @@
return None, None
def get_file_context_from_ctx( ctx, filename ):
+ """Return the mercurial file context for a specified file."""
# We have to be careful in determining if we found the correct file because multiple files with the same name may be in different directories
# within ctx if the files were moved within the change set. For example, in the following ctx.files() list, the former may have been moved to
# the latter: ['tmap_wrapper_0.0.19/tool_data_table_conf.xml.sample', 'tmap_wrapper_0.3.3/tool_data_table_conf.xml.sample']. Another scenario
@@ -473,6 +483,7 @@
return trans.sa_session.query( trans.model.ToolShedRepository ).get( trans.security.decode_id( id ) )
def get_named_tmpfile_from_ctx( ctx, filename, dir ):
+ """Return a named temporary file created from a specified file with a given name included in a repository changeset revision."""
filename = strip_path( filename )
for ctx_file in ctx.files():
ctx_file_name = strip_path( ctx_file )
@@ -958,6 +969,14 @@
except Exception, e:
log.exception( "An error occurred sending a tool shed repository update alert by email." )
+def handle_galaxy_url( trans, **kwd ):
+ galaxy_url = kwd.get( 'galaxy_url', None )
+ if galaxy_url:
+ trans.set_cookie( galaxy_url, name='toolshedgalaxyurl' )
+ else:
+ galaxy_url = trans.get_cookie( name='toolshedgalaxyurl' )
+ return galaxy_url
+
def open_repository_files_folder( trans, folder_path ):
"""Return a list of dictionaries, each of which contains information for a file or directory contained within a directory in a repository file hierarchy."""
try:
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.