'Download an archive of the repository files compressed as zip, gz or bz2.'

@web.expose
def download(self, trans, repository_id, changeset_revision, file_type, **kwd):

    repository = repository_util.get_repository_in_tool_shed(trans.app, repository_id)
    file_type_str = basic_util.get_file_type_str(changeset_revision, file_type)
    repository.times_downloaded += 1
    trans.sa_session.add(repository)
    trans.sa_session.flush()
    tool_shed_url = web.url_for('/', qualified=True)
    pathspec = ['repos', str(repository.user.username), str(repository.name), 'archive', file_type_str]
    download_url = util.build_url(tool_shed_url, pathspec=pathspec)
    return trans.response.send_redirect(download_url)
