def validate_repository_name(app, name, user):
 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)
 check_existing = get_repository_by_name_and_owner(app, name, user.username)
 if (check_existing is not None):
  if check_existing.deleted:
   return ('You own a deleted repository named <b>%s</b>, please choose a different name.' % escape(name))
  else:
   return ('You already own a repository named <b>%s</b>, please choose a different name.' % escape(name))
 if (len(name) < 2):
  return 'Repository names must be at least 2 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 ''

def validate_repository_name ( app , name , user ) : 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 ) check_existing = get_repository_by_name_and_owner ( app , name , user . username ) if ( check_existing is not None ) : if check_existing . deleted : return ( 'You own a deleted repository named <b>%s</b>, please choose a different name.' % escape ( name ) ) else : return ( 'You already own a repository named <b>%s</b>, please choose a different name.' % escape ( name ) ) if ( len ( name ) < 2 ) : return 'Repository names must be at least 2 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 ''
validate whether the given name qualifies as a new ts repo name .