Пример #1
0
def path_summary_more(request, translation_project, dir_path, filename=None):
    """Returns an HTML snippet with more detailed summary information
       for the current path."""
    current_path = translation_project.directory.pootle_path + dir_path

    if filename:
        current_path = current_path + filename
        store = get_object_or_404(Store, pootle_path=current_path)
        directory = store.parent
    else:
        directory = get_object_or_404(Directory, pootle_path=current_path)
        store = None

    path_obj = store or directory

    path_stats = get_raw_stats(path_obj)
    translation_stats = get_translation_stats(path_obj, path_stats)
    quality_checks = get_quality_check_failures(path_obj, path_stats)

    context = {
        'check_failures': quality_checks,
        'trans_stats': translation_stats,
    }

    return render_to_response('translation_project/xhr-path_summary.html',
                              context, RequestContext(request))
Пример #2
0
def path_summary_more(request, translation_project, dir_path, filename=None):
    """Returns an HTML snippet with more detailed summary information
       for the current path."""
    current_path = translation_project.directory.pootle_path + dir_path

    if filename:
        current_path = current_path + filename
        store = get_object_or_404(Store, pootle_path=current_path)
        directory = store.parent
    else:
        directory = get_object_or_404(Directory, pootle_path=current_path)
        store = None

    path_obj = store or directory

    path_stats = get_raw_stats(path_obj)
    translation_stats = get_translation_stats(path_obj, path_stats)
    quality_checks = get_quality_check_failures(path_obj, path_stats)

    context = {
        'check_failures': quality_checks,
        'trans_stats': translation_stats,
    }

    return render_to_response('translation_project/xhr-path_summary.html',
                              context, RequestContext(request))
Пример #3
0
def path_summary_more(request, *args, **kwargs):
    """Returns an HTML snippet with more detailed summary information
       for the current path."""
    context = {
        'check_failures': get_quality_check_failures(request.resource_obj),
    }
    return render_to_response('translation_projects/xhr_path_summary_more.html',
                              context, RequestContext(request))
Пример #4
0
def path_summary_more(request, *args, **kwargs):
    """Returns an HTML snippet with more detailed summary information
       for the current path."""
    context = {
        'check_failures': get_quality_check_failures(request.resource_obj),
    }
    return render_to_response(
        'translation_projects/xhr_path_summary_more.html', context,
        RequestContext(request))
Пример #5
0
def get_failing_checks(request, pathobj):
    """Gets a list of failing checks for the current object.

    :return: JSON string with a list of failing check categories which
             include the actual checks that are failing.
    """
    stats = get_raw_stats(pathobj)
    failures = get_quality_check_failures(pathobj, stats, include_url=False)

    response = jsonify(failures)

    return HttpResponse(response, mimetype="application/json")
Пример #6
0
def tp_dir_summary(request, translation_project, dir_path):
    current_path = translation_project.directory.pootle_path + dir_path
    directory = get_object_or_404(Directory, pootle_path=current_path)

    directory_stats = get_raw_stats(directory)
    translation_stats = get_translation_stats(directory, directory_stats)
    quality_checks = get_quality_check_failures(directory, directory_stats)

    context = {
        'check_failures': quality_checks,
        'trans_stats': translation_stats,
    }

    return render_to_response('translation_project/xhr-dir_summary.html',
                              context, RequestContext(request))
Пример #7
0
def get_failing_checks(request, path_obj):
    """Gets a list of failing checks for the current object.

    :return: JSON string with a list of failing check categories which
             include the actual checks that are failing.
    """
    if "goal" in request.GET and request.GET["goal"]:
        try:
            goal = Goal.objects.get(slug=request.GET["goal"])
        except Goal.DoesNotExist:
            raise Http404
        failures = goal.get_failing_checks_for_path(path_obj.pootle_path)
    else:
        stats = get_raw_stats(path_obj)
        failures = get_quality_check_failures(path_obj, stats, include_url=False)

    response = jsonify(failures)

    return HttpResponse(response, mimetype="application/json")