Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d0bfdd2b
Commit
d0bfdd2b
authored
Aug 29, 2016
by
Ehtesham
Committed by
muzaffaryousaf
Aug 31, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removing default error formatting label
parent
9221450e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
47 deletions
+8
-47
common/lib/capa/capa/capa_problem.py
+0
-9
common/lib/capa/capa/templates/choicetext.html
+3
-3
common/lib/capa/capa/templates/textline.html
+2
-2
common/lib/capa/capa/tests/test_capa_problem.py
+0
-28
common/lib/capa/capa/tests/test_html_render.py
+1
-2
common/lib/xmodule/xmodule/tests/test_capa_module.py
+2
-3
No files found.
common/lib/capa/capa/capa_problem.py
View file @
d0bfdd2b
...
@@ -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
...
...
common/lib/capa/capa/templates/choicetext.html
View file @
d0bfdd2b
<
%!
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
:
<%
<%
...
...
common/lib/capa/capa/templates/textline.html
View file @
d0bfdd2b
...
@@ -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>
common/lib/capa/capa/tests/test_capa_problem.py
View file @
d0bfdd2b
...
@@ -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.
...
...
common/lib/capa/capa/tests/test_html_render.py
View file @
d0bfdd2b
...
@@ -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'
:
''
}
}
...
...
common/lib/xmodule/xmodule/tests/test_capa_module.py
View file @
d0bfdd2b
...
@@ -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'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment