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
ea032c58
Commit
ea032c58
authored
Sep 19, 2014
by
Usman Khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If matlab grader sent unparsable response, show error message
instead of trying to render the response. TNL-388
parent
87d135a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletions
+16
-1
common/lib/capa/capa/inputtypes.py
+16
-1
No files found.
common/lib/capa/capa/inputtypes.py
View file @
ea032c58
...
@@ -808,6 +808,7 @@ class MatlabInput(CodeInput):
...
@@ -808,6 +808,7 @@ class MatlabInput(CodeInput):
Handle matlab-specific parsing
Handle matlab-specific parsing
"""
"""
_
=
self
.
capa_system
.
i18n
.
ugettext
_
=
self
.
capa_system
.
i18n
.
ugettext
submitted_msg
=
_
(
"Submitted. As soon as a response is returned, "
submitted_msg
=
_
(
"Submitted. As soon as a response is returned, "
"this message will be replaced by that feedback."
)
"this message will be replaced by that feedback."
)
self
.
submitted_msg
=
submitted_msg
self
.
submitted_msg
=
submitted_msg
...
@@ -889,9 +890,23 @@ class MatlabInput(CodeInput):
...
@@ -889,9 +890,23 @@ class MatlabInput(CodeInput):
def
_extra_context
(
self
):
def
_extra_context
(
self
):
""" Set up additional context variables"""
""" Set up additional context variables"""
_
=
self
.
capa_system
.
i18n
.
ugettext
queue_msg
=
self
.
queue_msg
if
len
(
self
.
queue_msg
)
>
0
:
# An empty string cannot be parsed as XML but is okay to include in the template.
try
:
etree
.
XML
(
u'<div>{0}</div>'
.
format
(
self
.
queue_msg
))
except
etree
.
XMLSyntaxError
:
try
:
html5lib
.
parseFragment
(
self
.
queue_msg
,
treebuilder
=
'lxml'
,
namespaceHTMLElements
=
False
)[
0
]
except
(
IndexError
,
ValueError
):
# If neither can parse queue_msg, it contains invalid xml.
queue_msg
=
u"<span>{0}</span>"
.
format
(
_
(
"Error running code."
))
extra_context
=
{
extra_context
=
{
'queue_len'
:
str
(
self
.
queue_len
),
'queue_len'
:
str
(
self
.
queue_len
),
'queue_msg'
:
self
.
queue_msg
,
'queue_msg'
:
queue_msg
,
'button_enabled'
:
self
.
button_enabled
(),
'button_enabled'
:
self
.
button_enabled
(),
'matlab_editor_js'
:
'{static_url}js/vendor/CodeMirror/octave.js'
.
format
(
'matlab_editor_js'
:
'{static_url}js/vendor/CodeMirror/octave.js'
.
format
(
static_url
=
self
.
capa_system
.
STATIC_URL
),
static_url
=
self
.
capa_system
.
STATIC_URL
),
...
...
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