Exemplo n.º 1
0
def perform_request_run_queries(query_ids,
                                user_id,
                                job_id,
                                language=CFG_SITE_LANG):
    """Displays a page contining results from execution of given queries.

    @param query_ids: list of query identifiers
    @param user_id: identifier of the user running the queries
    @param language: language of the page
    """
    exporter = FieldExporter()

    _check_user_ownership_on_job(user_id, job_id, language)
    job = fieldexporter_dblayer.get_job(job_id)
    job_result = fieldexporter_dblayer.JobResult(job)

    queries_results = []
    for current_id in query_ids:
        _check_user_ownership_on_query(user_id, current_id, language)
        current_query = fieldexporter_dblayer.get_query(current_id)
        current_result = exporter.execute_query(current_query)
        job_result.add_query_result(current_result)

    return fieldexporter_templates.tmpl_display_queries_results(
        job_result, language)
def perform_request_edit_query(query_id, job_id, user_id, language = CFG_SITE_LANG):
    """Displays a page where the user can edit information
    about a job.

    @param query_id: identifier of the query that will be edited
    @param job_id: identifier of the job containing the query
    @param user_id: identifier of the user editing the query
    @param language: language of the page
    """
    _check_user_ownership_on_job(user_id, job_id, language)
    _check_user_ownership_on_query(user_id, query_id, language)

    query = fieldexporter_dblayer.get_query(query_id)
    return fieldexporter_templates.tmpl_edit_query(query, job_id, language)
def perform_request_run_queries(query_ids, user_id, job_id, language = CFG_SITE_LANG):
    """Displays a page contining results from execution of given queries.

    @param query_ids: list of query identifiers
    @param user_id: identifier of the user running the queries
    @param language: language of the page
    """
    exporter = FieldExporter()

    _check_user_ownership_on_job(user_id, job_id, language)
    job = fieldexporter_dblayer.get_job(job_id)
    job_result = fieldexporter_dblayer.JobResult(job)

    queries_results = []
    for current_id in query_ids:
        _check_user_ownership_on_query(user_id, current_id, language)
        current_query = fieldexporter_dblayer.get_query(current_id)
        current_result = exporter.execute_query(current_query)
        job_result.add_query_result(current_result)

    return fieldexporter_templates.tmpl_display_queries_results(job_result, language)