commit/galaxy-central: greg: Change tool shed repository type "generic" to be "unrestricted".
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ea94ef1419d0/ Changeset: ea94ef1419d0 User: greg Date: 2013-07-15 15:40:43 Summary: Change tool shed repository type "generic" to be "unrestricted". Affected #: 10 files diff -r d3832bec213c031ea12eaf3d2292a5363e9e88b9 -r ea94ef1419d04dc442644edc0090f9d165fad2fd 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 @@ -964,7 +964,7 @@ long_description = kwd.get( 'long_description', '' ) category_ids = util.listify( kwd.get( 'category_id', '' ) ) selected_categories = [ trans.security.decode_id( id ) for id in category_ids ] - repository_type = kwd.get( 'repository_type', rt_util.GENERIC ) + repository_type = kwd.get( 'repository_type', rt_util.UNRESTRICTED ) if kwd.get( 'create_repository_button', False ): error = False message = self.__validate_repository_name( name, trans.user ) diff -r d3832bec213c031ea12eaf3d2292a5363e9e88b9 -r ea94ef1419d04dc442644edc0090f9d165fad2fd lib/galaxy/webapps/tool_shed/model/migrate/versions/0020_add_repository_type_column.py --- a/lib/galaxy/webapps/tool_shed/model/migrate/versions/0020_add_repository_type_column.py +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0020_add_repository_type_column.py @@ -31,8 +31,8 @@ assert c is Repository_table.c.type except Exception, e: print "Adding type column to the repository table failed: %s" % str( e ) - # Update the type column to have the default generic value. - cmd = "UPDATE repository SET type = 'generic'" + # Update the type column to have the default unrestricted value. + cmd = "UPDATE repository SET type = 'unrestricted'" migrate_engine.execute( cmd ) def downgrade( migrate_engine ): diff -r d3832bec213c031ea12eaf3d2292a5363e9e88b9 -r ea94ef1419d04dc442644edc0090f9d165fad2fd lib/galaxy/webapps/tool_shed/model/migrate/versions/0021_change_repository_type_value.py --- /dev/null +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0021_change_repository_type_value.py @@ -0,0 +1,35 @@ +"""Migration script to change repository.type column value from generic to unrestricted.""" + +from sqlalchemy import * +from sqlalchemy.orm import * +from migrate import * +from migrate.changeset import * + +# Need our custom types, but don't import anything else from model +from galaxy.model.custom_types import * + +import sys, logging +log = logging.getLogger( __name__ ) +log.setLevel(logging.DEBUG) +handler = logging.StreamHandler( sys.stdout ) +format = "%(name)s %(levelname)s %(asctime)s %(message)s" +formatter = logging.Formatter( format ) +handler.setFormatter( formatter ) +log.addHandler( handler ) + +metadata = MetaData() + +def upgrade( migrate_engine ): + print __doc__ + metadata.bind = migrate_engine + metadata.reflect() + # Update the type column to have the default unrestricted value. + cmd = "UPDATE repository SET type = 'unrestricted' WHERE type = 'generic'" + migrate_engine.execute( cmd ) + +def downgrade( migrate_engine ): + metadata.bind = migrate_engine + metadata.reflect() + # Update the type column to have the default generic value. + cmd = "UPDATE repository SET type = 'generic' WHERE type = 'unrestricted'" + migrate_engine.execute( cmd ) diff -r d3832bec213c031ea12eaf3d2292a5363e9e88b9 -r ea94ef1419d04dc442644edc0090f9d165fad2fd lib/tool_shed/repository_types/generic.py --- a/lib/tool_shed/repository_types/generic.py +++ /dev/null @@ -1,20 +0,0 @@ -import logging -import tool_shed.repository_types.util as rt_util -from tool_shed.repository_types.metadata import Metadata - -log = logging.getLogger( __name__ ) - - -class Generic( Metadata ): - - def __init__( self ): - self.type = rt_util.GENERIC - self.label = 'Generic' - - def is_valid_for_type( self, app, repository, revisions_to_check=None ): - """A repository's type can only be changed to the generic type if it is new or has never been installed.""" - if repository.is_new( app ): - return True - if repository.times_downloaded == 0: - return True - return False diff -r d3832bec213c031ea12eaf3d2292a5363e9e88b9 -r ea94ef1419d04dc442644edc0090f9d165fad2fd lib/tool_shed/repository_types/registry.py --- a/lib/tool_shed/repository_types/registry.py +++ b/lib/tool_shed/repository_types/registry.py @@ -1,5 +1,5 @@ import logging -import generic +import unrestricted import tool_dependency_definition from galaxy.util.odict import odict @@ -10,7 +10,7 @@ def __init__( self ): self.repository_types_by_label = odict() - self.repository_types_by_label[ 'generic' ] = generic.Generic() + self.repository_types_by_label[ 'unrestricted' ] = unrestricted.Unrestricted() self.repository_types_by_label[ 'tool_dependency_definition' ] = tool_dependency_definition.ToolDependencyDefinition() def get_class_by_label( self, label ): diff -r d3832bec213c031ea12eaf3d2292a5363e9e88b9 -r ea94ef1419d04dc442644edc0090f9d165fad2fd lib/tool_shed/repository_types/unrestricted.py --- /dev/null +++ b/lib/tool_shed/repository_types/unrestricted.py @@ -0,0 +1,20 @@ +import logging +import tool_shed.repository_types.util as rt_util +from tool_shed.repository_types.metadata import Metadata + +log = logging.getLogger( __name__ ) + + +class Unrestricted( Metadata ): + + def __init__( self ): + self.type = rt_util.UNRESTRICTED + self.label = 'Unrestricted' + + def is_valid_for_type( self, app, repository, revisions_to_check=None ): + """A repository's type can only be changed to the unrestricted type if it is new or has never been installed.""" + if repository.is_new( app ): + return True + if repository.times_downloaded == 0: + return True + return False diff -r d3832bec213c031ea12eaf3d2292a5363e9e88b9 -r ea94ef1419d04dc442644edc0090f9d165fad2fd lib/tool_shed/repository_types/util.py --- a/lib/tool_shed/repository_types/util.py +++ b/lib/tool_shed/repository_types/util.py @@ -3,10 +3,10 @@ log = logging.getLogger( __name__ ) -GENERIC = 'generic' +UNRESTRICTED = 'unrestricted' TOOL_DEPENDENCY_DEFINITION = 'tool_dependency_definition' -types = [ GENERIC, TOOL_DEPENDENCY_DEFINITION ] +types = [ UNRESTRICTED, TOOL_DEPENDENCY_DEFINITION ] def build_repository_type_select_field( trans, repository=None, name='repository_type' ): """Called from the Tool Shed to generate the current list of supported repository types.""" diff -r d3832bec213c031ea12eaf3d2292a5363e9e88b9 -r ea94ef1419d04dc442644edc0090f9d165fad2fd lib/tool_shed/util/metadata_util.py --- a/lib/tool_shed/util/metadata_util.py +++ b/lib/tool_shed/util/metadata_util.py @@ -1237,7 +1237,7 @@ if 'datatypes' in metadata: ancestor_datatypes = metadata[ 'datatypes' ] # The saved metadata must be a subset of the new metadata. - datatype_comparison = compare_datatypes( ancestor_datatypes, current_datatypes ) + datatype_comparison = compare_datatypes( trans, ancestor_datatypes, current_datatypes ) if datatype_comparison == NOT_EQUAL_AND_NOT_SUBSET: return True else: diff -r d3832bec213c031ea12eaf3d2292a5363e9e88b9 -r ea94ef1419d04dc442644edc0090f9d165fad2fd templates/webapps/tool_shed/repository/common.mako --- a/templates/webapps/tool_shed/repository/common.mako +++ b/templates/webapps/tool_shed/repository/common.mako @@ -189,8 +189,8 @@ <div class="toolParamHelp" style="clear: both;"> Select the repository type based on the following criteria. <ul> - %if util.GENERIC in repository_types: - <li><b>Generic</b> - contents can be any set of valid Galaxy utilities + %if util.UNRESTRICTED in repository_types: + <li><b>Unrestricted</b> - contents can be any set of valid Galaxy utilities or files %endif %if util.TOOL_DEPENDENCY_DEFINITION in repository_types: <li><b>Tool dependency definition</b> - contents will always be restricted to one file named tool_dependencies.xml diff -r d3832bec213c031ea12eaf3d2292a5363e9e88b9 -r ea94ef1419d04dc442644edc0090f9d165fad2fd test/tool_shed/functional/test_0000_basic_repository_features.py --- a/test/tool_shed/functional/test_0000_basic_repository_features.py +++ b/test/tool_shed/functional/test_0000_basic_repository_features.py @@ -151,7 +151,7 @@ commit_message="Uploaded filtering.txt", strings_displayed=[], strings_not_displayed=[] ) - self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) + self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) def test_0055_upload_filtering_test_data( self ): '''Upload filtering test data.''' @@ -219,19 +219,19 @@ commit_message="Uploaded readme.txt", strings_displayed=[], strings_not_displayed=[] ) - self.display_manage_repository_page( repository, strings_displayed=[ 'This is a readme file.' ] ) + self.display_manage_repository_page( repository, strings_displayed=[ 'This is a readme file.' ] ) # Verify that there is a different readme file for each metadata revision. metadata_revisions = self.get_repository_metadata_revisions( repository ) self.display_manage_repository_page( repository, - strings_displayed=[ 'Readme file for filtering 1.1.0', - 'This is a readme file.' ] ) + strings_displayed=[ 'Readme file for filtering 1.1.0', + 'This is a readme file.' ] ) def test_0075_delete_readme_txt_file( self ): '''Delete the readme.txt file.''' repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.delete_files_from_repository( repository, filenames=[ 'readme.txt' ] ) self.check_count_of_metadata_revisions_associated_with_repository( repository, metadata_count=2 ) - self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) + self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) def test_0080_search_for_valid_filter_tool( self ): '''Search for the filtering tool by tool ID, name, and version.''' @@ -335,7 +335,7 @@ commit_message="Uploaded new readme.txt with invalid ascii characters.", strings_displayed=[], strings_not_displayed=[] ) - self.display_manage_repository_page( repository, strings_displayed=[ 'These characters should not' ] ) + self.display_manage_repository_page( repository, strings_displayed=[ 'These characters should not' ] ) def test_0130_verify_handling_of_invalid_characters( self ): '''Load the above changeset in the change log and confirm that there is no server error displayed.''' @@ -353,5 +353,5 @@ # Check for the changeset revision, repository name, owner username, 'repos' in the clone url, and the captured # unicode decoding error message. strings_displayed = [ 'Changeset %d:%s' % ( revision_number, revision_hash ), 'filtering_0000', 'user1', 'repos', 'added:', - '+These characters should not' ] + '+These characters should not' ] self.load_changeset_in_tool_shed( repository_id, changeset_revision, strings_displayed=strings_displayed ) \ No newline at end of file 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)
-
commits-noreply@bitbucket.org