def generate_sharable_link_for_repository_in_tool_shed(repository, changeset_revision=None):
 base_url = web.url_for('/', qualified=True).rstrip('/')
 (protocol, base) = base_url.split('://')
 sharable_url = ('%s://%s/view/%s/%s' % (protocol, base, repository.user.username, repository.name))
 if changeset_revision:
  sharable_url += ('/%s' % changeset_revision)
 return sharable_url

def generate_sharable_link_for_repository_in_tool_shed ( repository , changeset_revision = None ) : base_url = web . url_for ( '/' , qualified = True ) . rstrip ( '/' ) ( protocol , base ) = base_url . split ( '://' ) sharable_url = ( '%s://%s/view/%s/%s' % ( protocol , base , repository . user . username , repository . name ) ) if changeset_revision : sharable_url += ( '/%s' % changeset_revision ) return sharable_url
generate the url for sharing a repository that is in the tool shed .