commit/galaxy-central: greg: Restrict the ability to use reserved words in the tool shed for repository names and public user names.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/1605621deee2/ changeset: 1605621deee2 user: greg date: 2013-01-31 15:28:40 summary: Restrict the ability to use reserved words in the tool shed for repository names and public user names. affected #: 2 files diff -r 04e22199687138a539734d108bc711fe96ab1083 -r 1605621deee25ec1ae8e7a72f4c1dc4f257f6760 lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -951,7 +951,9 @@ if not description: message = 'Enter a description.' error = True - if not error: + if error: + status = 'error' + else: # Add the repository record to the db repository = trans.app.model.Repository( name=name, description=description, @@ -2458,15 +2460,17 @@ # 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: - return "You already have a repository named '%s', so choose a different name." % name + 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." if len( name ) > 80: return "Repository names cannot be more than 80 characters in length." if not( VALID_REPOSITORYNAME_RE.match( name ) ): - return "Repository names must contain only lower-case letters, numbers and underscore '_'." + return "Repository names must contain only lower-case letters, numbers and underscore <b>_</b>." return '' @web.expose def view_changelog( self, trans, id, **kwd ): diff -r 04e22199687138a539734d108bc711fe96ab1083 -r 1605621deee25ec1ae8e7a72f4c1dc4f257f6760 lib/galaxy/webapps/galaxy/controllers/user.py --- a/lib/galaxy/webapps/galaxy/controllers/user.py +++ b/lib/galaxy/webapps/galaxy/controllers/user.py @@ -930,8 +930,11 @@ status=status ) def __validate( self, trans, params, email, password, confirm, username ): # If coming from the community webapp, we'll require a public user name - if trans.webapp.name == 'community' and not username: - return "A public user name is required" + if trans.webapp.name == 'community': + if not username: + return "A public user name is required in the tool shed." + if username in [ 'repos' ]: + return "The term <b>%s</b> is a reserved word in the tool shed, so it cannot be used as a public user name." % username message = validate_email( trans, email ) if not message: message = validate_password( trans, password, confirm ) 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)
-
Bitbucket