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
b36d0dd9
Commit
b36d0dd9
authored
Jun 04, 2012
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
raise helpful error in NumericalResponse when missing required "answer" attribute
parent
613ff49d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
djangoapps/courseware/capa/responsetypes.py
+4
-0
No files found.
djangoapps/courseware/capa/responsetypes.py
View file @
b36d0dd9
...
@@ -185,6 +185,10 @@ class OptionResponse(GenericResponse):
...
@@ -185,6 +185,10 @@ class OptionResponse(GenericResponse):
class
NumericalResponse
(
GenericResponse
):
class
NumericalResponse
(
GenericResponse
):
def
__init__
(
self
,
xml
,
context
,
system
=
None
):
def
__init__
(
self
,
xml
,
context
,
system
=
None
):
self
.
xml
=
xml
self
.
xml
=
xml
if
not
xml
.
get
(
'answer'
):
msg
=
"Error in problem specification: numericalresponse missing required answer attribute
\n
"
msg
+=
"See XML source line
%
s"
%
getattr
(
xml
,
'sourceline'
,
'<unavailable>'
)
raise
Exception
,
msg
self
.
correct_answer
=
contextualize_text
(
xml
.
get
(
'answer'
),
context
)
self
.
correct_answer
=
contextualize_text
(
xml
.
get
(
'answer'
),
context
)
try
:
try
:
self
.
tolerance_xml
=
xml
.
xpath
(
'//*[@id=$id]//responseparam[@type="tolerance"]/@default'
,
self
.
tolerance_xml
=
xml
.
xpath
(
'//*[@id=$id]//responseparam[@type="tolerance"]/@default'
,
...
...
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