def perform_request_download_job_result(req, job_result_id, output_format, user_id, language = CFG_SITE_LANG):
    """
    Returns to the browser zip file containing the content of the job result

    @param req: request as received from apache
    @param job_result_id: identifier of the job result that should be displayed
    @param user_id: identifier of the current user
    @param language: language of the page
    @param output_format: format for downloading the result
    """
    _check_user_ownership_on_job_result(user_id, job_result_id, language)

    job_result = fieldexporter_dblayer.get_job_result(job_result_id)
    if output_format != fieldexporter_dblayer.Job.OUTPUT_FORMAT_MISSING:
        job_result.get_job().set_output_format(output_format)

    download_file_name = "result.zip"
    temp_zip_file_path = ""

    try:
        temp_zip_file_path = fieldexporter_dblayer.create_temporary_zip_file_with_job_result(job_result)
        bibdocfile.stream_file(req, temp_zip_file_path, download_file_name)
    finally:
        if os.path.exists(temp_zip_file_path):
            os.remove(temp_zip_file_path)
def perform_request_job_results(job_result_id, user_id, language = CFG_SITE_LANG):
    """Displays a page with information about the results of a particular job.

    @param job_result_id: identifier of the job result that should be displayed
    @param user_id: identifier of the current user
    @param language: language of the page
    """
    _check_user_ownership_on_job_result(user_id, job_result_id, language)

    job_result = fieldexporter_dblayer.get_job_result(job_result_id)

    return fieldexporter_templates.tmpl_display_job_result_information(job_result, language)
def perform_request_display_job_result(job_result_id, output_format, user_id, language = CFG_SITE_LANG):
    """Displays a page with the results of a particular job.

    @param job_result_id: identifier of the job result that should be displayed
    @param user_id: identifier of the current user
    @param language: language of the page
    """
    _check_user_ownership_on_job_result(user_id, job_result_id, language)

    job_result = fieldexporter_dblayer.get_job_result(job_result_id)

    if output_format != fieldexporter_dblayer.Job.OUTPUT_FORMAT_MISSING:
        job_result.get_job().set_output_format(output_format)

    return fieldexporter_templates.tmpl_display_queries_results(job_result, language)