def generate_clone_url_for_repository_in_tool_shed(user, repository):
 base_url = url_for('/', qualified=True).rstrip('/')
 if user:
  (protocol, base) = base_url.split('://')
  username = ('%s@' % user.username)
  return ('%s://%s%s/repos/%s/%s' % (protocol, username, base, repository.user.username, repository.name))
 else:
  return ('%s/repos/%s/%s' % (base_url, repository.user.username, repository.name))

def generate_clone_url_for_repository_in_tool_shed ( user , repository ) : base_url = url_for ( '/' , qualified = True ) . rstrip ( '/' ) if user : ( protocol , base ) = base_url . split ( '://' ) username = ( '%s@' % user . username ) return ( '%s://%s%s/repos/%s/%s' % ( protocol , username , base , repository . user . username , repository . name ) ) else : return ( '%s/repos/%s/%s' % ( base_url , repository . user . username , repository . name ) )
generate the url for cloning a repository that is in the tool shed .