'Send the list of repository_ids and changeset_revisions to Galaxy so it can begin the installation
process.  If the value of repository_ids is not received, then the name and owner of a single repository
must be received to install a single repository.'

@web.expose
def install_repositories_by_revision(self, trans, **kwd):

    repository_ids = kwd.get('repository_ids', None)
    changeset_revisions = kwd.get('changeset_revisions', None)
    name = kwd.get('name', None)
    owner = kwd.get('owner', None)
    if (not repository_ids):
        repository = repository_util.get_repository_by_name_and_owner(trans.app, name, owner)
        repository_ids = trans.security.encode_id(repository.id)
    galaxy_url = common_util.handle_galaxy_url(trans, **kwd)
    if galaxy_url:
        params = dict(tool_shed_url=web.url_for('/', qualified=True), repository_ids=','.join(util.listify(repository_ids)), changeset_revisions=','.join(util.listify(changeset_revisions)))
        pathspec = ['admin_toolshed', 'prepare_for_install']
        url = util.build_url(galaxy_url, pathspec=pathspec, params=params)
        return trans.response.send_redirect(url)
    else:
        message = ('Repository    installation    is    not    possible    due    to    an    invalid    Galaxy    URL:    <b>%s</b>.        ' % galaxy_url)
        message += 'You    may    need    to    enable    third-party    cookies    in    your    browser.        '
        status = 'error'
        return trans.response.send_redirect(web.url_for(controller='repository', action='browse_valid_categories', message=message, status=status))
