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
64a4a62c
Commit
64a4a62c
authored
Jul 02, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't pass fileobjects to LoncapaProblem
parent
3355f804
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
common/lib/xmodule/xmodule/capa_module.py
+5
-6
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
64a4a62c
...
...
@@ -141,9 +141,8 @@ class CapaModule(XModule):
msg
=
'<p>
%
s</p>'
%
msg
.
replace
(
'<'
,
'<'
)
msg
+=
'<p><pre>
%
s</pre></p>'
%
traceback
.
format_exc
()
.
replace
(
'<'
,
'<'
)
# create a dummy problem with error message instead of failing
fp
=
StringIO
.
StringIO
(
'<problem><text><font color="red" size="+2">Problem file
%
s has an error:</font>
%
s</text></problem>'
%
(
self
.
filename
,
msg
))
fp
.
name
=
"StringIO"
self
.
lcp
=
LoncapaProblem
(
fp
,
self
.
location
.
html_id
(),
instance_state
,
seed
=
seed
,
system
=
self
.
system
)
problem_text
=
'<problem><text><font color="red" size="+2">Problem file
%
s has an error:</font>
%
s</text></problem>'
%
(
self
.
filename
,
msg
)
self
.
lcp
=
LoncapaProblem
(
problem_text
,
self
.
location
.
html_id
(),
instance_state
,
seed
=
seed
,
system
=
self
.
system
)
else
:
raise
...
...
@@ -395,13 +394,13 @@ class CapaModule(XModule):
correct_map
=
self
.
lcp
.
grade_answers
(
answers
)
except
StudentInputError
as
inst
:
# TODO (vshnayder): why is this line here?
self
.
lcp
=
LoncapaProblem
(
self
.
system
.
filestore
.
open
(
self
.
filename
),
self
.
lcp
=
LoncapaProblem
(
self
.
system
.
filestore
.
open
(
self
.
filename
)
.
read
()
,
id
=
lcp_id
,
state
=
old_state
,
system
=
self
.
system
)
traceback
.
print_exc
()
return
{
'success'
:
inst
.
message
}
except
:
# TODO: why is this line here?
self
.
lcp
=
LoncapaProblem
(
self
.
system
.
filestore
.
open
(
self
.
filename
),
self
.
lcp
=
LoncapaProblem
(
self
.
system
.
filestore
.
open
(
self
.
filename
)
.
read
()
,
id
=
lcp_id
,
state
=
old_state
,
system
=
self
.
system
)
traceback
.
print_exc
()
raise
Exception
(
"error in capa_module"
)
...
...
@@ -486,7 +485,7 @@ class CapaModule(XModule):
# reset random number generator seed (note the self.lcp.get_state() in next line)
self
.
lcp
.
seed
=
None
self
.
lcp
=
LoncapaProblem
(
self
.
system
.
filestore
.
open
(
self
.
filename
),
self
.
lcp
=
LoncapaProblem
(
self
.
system
.
filestore
.
open
(
self
.
filename
)
.
read
()
,
self
.
location
.
html_id
(),
self
.
lcp
.
get_state
(),
system
=
self
.
system
)
event_info
[
'new_state'
]
=
self
.
lcp
.
get_state
()
...
...
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