Exemplo n.º 1
0
def rs_to_xml(rs):
    testsuite = TestSuite.objects.get_most_recent_testsuite()
    accessibility_testsuite = TestSuite.objects.get_most_recent_accessibility_testsuite()
    # testsuite_date = "{0}-{1}".format(testsuite.version_date, testsuite.version_revision)
    testsuite_date = str(testsuite.version_date)
    # accessibility_testsuite_date = "{0}-{1}".format(accessibility_testsuite.version_date, accessibility_testsuite.version_revision)
    accessibility_testsuite_date = str(accessibility_testsuite.version_date)

    testsuite_data = helper_functions.testsuite_to_dict(testsuite)
    accessibility_testsuite_data = helper_functions.testsuite_to_dict(accessibility_testsuite)

    rs_elm = RS(
        name=rs.name, version=rs.version, operating_system=rs.operating_system, locale=rs.locale, notes=rs.notes
    )
    result_set_elm = result_set_to_xml(rs, rs.get_default_result_set(), testsuite, testsuite_data, testsuite_date)
    rs_elm.append(result_set_elm)

    accessibility_result_sets = rs.get_accessibility_result_sets()

    for accessibility_result_set in accessibility_result_sets:
        accessibility_result_set_elm = result_set_to_xml(
            rs,
            accessibility_result_set,
            accessibility_testsuite,
            accessibility_testsuite_data,
            accessibility_testsuite_date,
        )
        rs_elm.append(accessibility_result_set_elm)
    print etree.tostring(rs_elm)
    return rs_elm
Exemplo n.º 2
0
    def get(self, request, *args, **kwargs):
        try:
            rs = ReadingSystem.objects.get(id=kwargs['pk'])
        except ReadingSystem.DoesNotExist:
            return render(request, "404.html", {})

        can_view = permissions.user_can_view_reading_system(request.user, rs, 'rs')
        if can_view == False:
            messages.add_message(request, messages.INFO, 'You do not have permission to view that reading system.')
            return redirect("/")

        testsuite = TestSuite.objects.get_most_recent_testsuite()
        data = helper_functions.testsuite_to_dict(testsuite)
        # split the data across 2 lists to make it easy to consume for the reading system view
        # TODO replace this with a multicolumn definition list
        first_half = []
        second_half = []
        for n in range(0, len(data)):
            if n < len(data)/2:
                first_half.append(data[n])
            else:
                second_half.append(data[n])

        return render(request, self.template_name, {'rs': rs, 'data': data,
            'first_half': first_half, 'second_half': second_half})
Exemplo n.º 3
0
def rs_to_xml(rs):
	testsuite = TestSuite.objects.get_most_recent_testsuite()
	data = helper_functions.testsuite_to_dict(testsuite)
	results_elm = RESULTS()
	for item in data:
		top_level_category_elm = category_to_xml(item, rs)
		results_elm.append(top_level_category_elm)

	evaluation = rs.get_current_evaluation()
	eval_elm = EVAL(
		RS(name=rs.name, version=rs.version, operating_system=rs.operating_system, locale=rs.locale, sdk_version=rs.sdk_version),
		results_elm,
		last_updated=str(evaluation.last_updated),	
	)
	return eval_elm
Exemplo n.º 4
0
    def get(self, request, *args, **kwargs):
        try:
            rs = ReadingSystem.objects.get(id=kwargs['pk'])
        except ReadingSystem.DoesNotExist:
            return render(request, "404.html", {})

        try:
            rset = ResultSet.objects.get(id=kwargs['rset'])
        except ResultSet.DoesNotExist:
            return render(request, "404.html", {})

        can_view = permissions.user_can_view_accessibility_result_set(request.user, rset)
        if can_view == False:
            messages.add_message(request, messages.INFO, 'You do not have permission to view that accessibility evaluation.')
            return redirect("/manage".format(rs.id))

        ts = TestSuite.objects.get_most_recent_testsuite_of_type(common.TESTSUITE_TYPE_ACCESSIBILITY)
        data = helper_functions.testsuite_to_dict(ts)
        return render(request, self.template_name, {'rs': rs, 'data': data, 'result_set': rset})
Exemplo n.º 5
0
 def get(self, request, *args, **kwargs):
     testsuite = TestSuite.objects.get_most_recent_testsuite()
     data = helper_functions.testsuite_to_dict(testsuite)
     action_url = "/compare/"
     return render(request, self.template_name, {"data": data, "action_url": action_url})