commit/galaxy-central: inithello: When creating a repository, make sure there are no repositories with the same name, deleted or active.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/77b5d4888d6d/ Changeset: 77b5d4888d6d Branch: stable User: inithello Date: 2013-12-11 18:43:36 Summary: When creating a repository, make sure there are no repositories with the same name, deleted or active. Affected #: 2 files diff -r 9d4cbf2a1c13dd481c10d28a28afb41d23553d18 -r 77b5d4888d6d957d24caccdcd5154bb8cb7574e4 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 @@ -933,7 +933,7 @@ repository_type = kwd.get( 'repository_type', rt_util.UNRESTRICTED ) if kwd.get( 'create_repository_button', False ): error = False - message = repository_maintenance_util.validate_repository_name( name, trans.user ) + message = repository_maintenance_util.validate_repository_name( trans.app, name, trans.user ) if message: error = True if not description: @@ -2070,7 +2070,7 @@ repository.long_description = long_description flush_needed = True if repository.times_downloaded == 0 and repo_name != repository.name: - message = repository_maintenance_util.validate_repository_name( repo_name, user ) + message = repository_maintenance_util.validate_repository_name( trans.app, repo_name, user ) if message: error = True else: diff -r 9d4cbf2a1c13dd481c10d28a28afb41d23553d18 -r 77b5d4888d6d957d24caccdcd5154bb8cb7574e4 lib/tool_shed/util/repository_maintenance_util.py --- a/lib/tool_shed/util/repository_maintenance_util.py +++ b/lib/tool_shed/util/repository_maintenance_util.py @@ -56,15 +56,18 @@ fp.write( 'hgext.purge=' ) fp.close() -def validate_repository_name( name, user ): +def validate_repository_name( app, name, user ): # Repository names must be unique for each user, must be at least four characters # in length and must contain only lower-case letters, numbers, and the '_' character. if name in [ 'None', None, '' ]: return 'Enter the required repository name.' if name in [ 'repos' ]: return "The term <b>%s</b> is a reserved word in the tool shed, so it cannot be used as a repository name." % name - for repository in user.active_repositories: - if repository.name == name: + check_existing = suc.get_repository_by_name_and_owner( app, name, user.username ) + if check_existing is not None: + if check_existing.deleted: + return 'You have a deleted repository named <b>%s</b>, so choose a different name.' % name + else: return "You already have a repository named <b>%s</b>, so choose a different name." % name if len( name ) < 4: return "Repository names must be at least 4 characters in length." 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