Commit d0bfdd2b by Ehtesham Committed by muzaffaryousaf

removing default error formatting label

parent 9221450e
...@@ -72,8 +72,6 @@ log = logging.getLogger(__name__) ...@@ -72,8 +72,6 @@ log = logging.getLogger(__name__)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# main class for this module # main class for this module
DEFAULT_QUESTION_TEXT = "Formatting error: You must explicitly specify the question text."
class LoncapaSystem(object): class LoncapaSystem(object):
""" """
...@@ -967,17 +965,10 @@ class LoncapaProblem(object): ...@@ -967,17 +965,10 @@ class LoncapaProblem(object):
label = label_tag[0].text label = label_tag[0].text
element_to_be_deleted = label_tag[0] element_to_be_deleted = label_tag[0]
label = label.strip() or DEFAULT_QUESTION_TEXT
# delete label or p element only if responsetype is fully accessible # delete label or p element only if responsetype is fully accessible
if response.tag in ACCESSIBLE_CAPA_RESPONSE_TYPES and element_to_be_deleted is not None: if response.tag in ACCESSIBLE_CAPA_RESPONSE_TYPES and element_to_be_deleted is not None:
element_to_be_deleted.getparent().remove(element_to_be_deleted) element_to_be_deleted.getparent().remove(element_to_be_deleted)
# for non-accessible responsetypes it may be possible that label attribute is not present
# in this case pass an empty label. remember label attribute is only used as value for aria-label
if response.tag not in ACCESSIBLE_CAPA_RESPONSE_TYPES and label == DEFAULT_QUESTION_TEXT:
label = ''
# Extract descriptions and set unique id on each description tag # Extract descriptions and set unique id on each description tag
description_tags = response.findall('description') description_tags = response.findall('description')
description_id = 1 description_id = 1
......
<%! from django.utils.translation import ugettext as _ %> <%! from django.utils.translation import ugettext as _ %>
<% element_checked = False %> <% element_checked = False %>
% for choice_id, _ in choices: % for choice_id, _ in choices:
<%choice_id = choice_id %> <% choice_id = choice_id %>
%if choice_id in value: %if choice_id in value:
<% element_checked = True %> <% element_checked = True %>
%endif %endif
%endfor % endfor
<section id="choicetextinput_${id}" class="choicetextinput"> <section id="choicetextinput_${id}" class="choicetextinput">
<form class="choicetextgroup capa_inputtype" id="inputtype_${id}"> <form class="choicetextgroup capa_inputtype" id="inputtype_${id}">
<div class="script_placeholder" data-src="${STATIC_URL}js/capa/choicetextinput.js"/> <div class="script_placeholder" data-src="${STATIC_URL}js/capa/choicetextinput.js"/>
<fieldset aria-label="${response_data['label']}"> <fieldset aria-label="${response_data['label']}">
% for choice_id, choice_description in choices: % for choice_id, choice_description in choices:
<%choice_id= choice_id %> <% choice_id = choice_id %>
<section id="forinput${choice_id}" <section id="forinput${choice_id}"
% if input_type == 'radio' and choice_id in value : % if input_type == 'radio' and choice_id in value :
<% <%
......
...@@ -56,8 +56,8 @@ ...@@ -56,8 +56,8 @@
</div> </div>
% endif % endif
% if msg: % if msg:
<span class="message">${HTML(msg)}</span> <span class="message">${HTML(msg)}</span>
% endif % endif
</div> </div>
...@@ -7,7 +7,6 @@ from lxml import etree ...@@ -7,7 +7,6 @@ from lxml import etree
import unittest import unittest
from . import new_loncapa_problem from . import new_loncapa_problem
from capa.capa_problem import DEFAULT_QUESTION_TEXT
class CAPAProblemTest(unittest.TestCase): class CAPAProblemTest(unittest.TestCase):
...@@ -159,33 +158,6 @@ class CAPAProblemTest(unittest.TestCase): ...@@ -159,33 +158,6 @@ class CAPAProblemTest(unittest.TestCase):
} }
) )
def test_default_question_text(self):
"""
Verify that default question text is shown when question is missing.
"""
xml = """
<problem>
<p>Be sure to check your spelling.</p>
<stringresponse answer="War" type="ci">
<description>Everybody needs somebody to talk to.</description>
<textline size="40"/>
</stringresponse>
</problem>
"""
problem = new_loncapa_problem(xml)
self.assertEqual(
problem.problem_data,
{
'1_2_1':
{
'label': DEFAULT_QUESTION_TEXT,
'descriptions': {
'description_1_1_1': "Everybody needs somebody to talk to."
}
}
}
)
def test_question_is_not_removed(self): def test_question_is_not_removed(self):
""" """
Verify that tag with question text is not removed when responsetype is not fully accessible. Verify that tag with question text is not removed when responsetype is not fully accessible.
......
...@@ -7,7 +7,6 @@ import mock ...@@ -7,7 +7,6 @@ import mock
from .response_xml_factory import StringResponseXMLFactory, CustomResponseXMLFactory from .response_xml_factory import StringResponseXMLFactory, CustomResponseXMLFactory
from . import test_capa_system, new_loncapa_problem from . import test_capa_system, new_loncapa_problem
from capa.capa_problem import DEFAULT_QUESTION_TEXT
class CapaHtmlRenderTest(unittest.TestCase): class CapaHtmlRenderTest(unittest.TestCase):
...@@ -186,7 +185,7 @@ class CapaHtmlRenderTest(unittest.TestCase): ...@@ -186,7 +185,7 @@ class CapaHtmlRenderTest(unittest.TestCase):
'id': '1_2_1', 'id': '1_2_1',
'trailing_text': '', 'trailing_text': '',
'size': None, 'size': None,
'response_data': {'label': DEFAULT_QUESTION_TEXT, 'descriptions': {}}, 'response_data': {'label': '', 'descriptions': {}},
'describedby': '' 'describedby': ''
} }
......
...@@ -21,7 +21,6 @@ from webob.multidict import MultiDict ...@@ -21,7 +21,6 @@ from webob.multidict import MultiDict
import xmodule import xmodule
from xmodule.tests import DATA_DIR from xmodule.tests import DATA_DIR
from capa import responsetypes from capa import responsetypes
from capa.capa_problem import DEFAULT_QUESTION_TEXT
from capa.responsetypes import (StudentInputError, LoncapaProblemError, from capa.responsetypes import (StudentInputError, LoncapaProblemError,
ResponseError) ResponseError)
from capa.xqueue_interface import XQueueInterface from capa.xqueue_interface import XQueueInterface
...@@ -2652,7 +2651,7 @@ class TestProblemCheckTracking(unittest.TestCase): ...@@ -2652,7 +2651,7 @@ class TestProblemCheckTracking(unittest.TestCase):
event = self.get_event_for_answers(module, answer_input_dict) event = self.get_event_for_answers(module, answer_input_dict)
self.assertEquals(event['submission'], { self.assertEquals(event['submission'], {
factory.answer_key(2): { factory.answer_key(2): {
'question': DEFAULT_QUESTION_TEXT, 'question': '',
'answer': '3.14', 'answer': '3.14',
'response_type': 'numericalresponse', 'response_type': 'numericalresponse',
'input_type': 'textline', 'input_type': 'textline',
...@@ -2783,7 +2782,7 @@ class TestProblemCheckTracking(unittest.TestCase): ...@@ -2783,7 +2782,7 @@ class TestProblemCheckTracking(unittest.TestCase):
event = self.get_event_for_answers(module, answer_input_dict) event = self.get_event_for_answers(module, answer_input_dict)
self.assertEquals(event['submission'], { self.assertEquals(event['submission'], {
factory.answer_key(2): { factory.answer_key(2): {
'question': DEFAULT_QUESTION_TEXT, 'question': '',
'answer': '3.14', 'answer': '3.14',
'response_type': 'numericalresponse', 'response_type': 'numericalresponse',
'input_type': 'textline', 'input_type': 'textline',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment