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
72584b59
Commit
72584b59
authored
May 03, 2013
by
Sarina
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1914 from edx/fix/sarina/new_formularesponse_defaults
Fix/sarina/new formularesponse defaults
parents
5d729c30
2cb3af1e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
common/lib/capa/capa/responsetypes.py
+13
-3
No files found.
common/lib/capa/capa/responsetypes.py
View file @
72584b59
...
...
@@ -1851,6 +1851,19 @@ class FormulaResponse(LoncapaResponse):
'formularesponse: undefined variable in given=
%
s'
%
given
)
raise
StudentInputError
(
"Invalid input: "
+
uv
.
message
+
" not permitted in answer"
)
except
ValueError
as
ve
:
if
'factorial'
in
ve
.
message
:
# This is thrown when fact() or factorial() is used in a formularesponse answer
# that tests on negative and/or non-integer inputs
# ve.message will be: `factorial() only accepts integral values` or `factorial() not defined for negative values`
log
.
debug
(
'formularesponse: factorial function used in response that tests negative and/or non-integer inputs. given={0}'
.
format
(
given
))
raise
StudentInputError
(
"factorial function not permitted in answer for this problem. Provided answer was: {0}"
.
format
(
given
))
# If non-factorial related ValueError thrown, handle it the same as any other Exception
log
.
debug
(
'formularesponse: error {0} in formula'
.
format
(
ve
))
raise
StudentInputError
(
"Invalid input: Could not parse '
%
s' as a formula"
%
cgi
.
escape
(
given
))
except
Exception
as
err
:
# traceback.print_exc()
log
.
debug
(
'formularesponse: error
%
s in formula'
%
err
)
...
...
@@ -1983,7 +1996,6 @@ class ImageResponse(LoncapaResponse):
self
.
ielements
=
self
.
inputfields
self
.
answer_ids
=
[
ie
.
get
(
'id'
)
for
ie
in
self
.
ielements
]
def
get_score
(
self
,
student_answers
):
correct_map
=
CorrectMap
()
expectedset
=
self
.
get_mapped_answers
()
...
...
@@ -2075,8 +2087,6 @@ class ImageResponse(LoncapaResponse):
return
answers
#-----------------------------------------------------------------------------
...
...
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