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
ada66adf
Commit
ada66adf
authored
Jul 31, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:MITx/mitx
parents
6f440018
2f95a8e1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
13 deletions
+20
-13
cms/djangoapps/contentstore/__init__.py
+0
-0
common/lib/capa/capa/inputtypes.py
+1
-1
common/lib/capa/capa/responsetypes.py
+16
-10
common/lib/capa/capa/templates/textbox.html
+2
-1
common/lib/xmodule/xmodule/capa_module.py
+1
-1
No files found.
cms/djangoapps/contentstore/__init__.py
0 → 100644
View file @
ada66adf
common/lib/capa/capa/inputtypes.py
View file @
ada66adf
...
...
@@ -315,7 +315,7 @@ def textbox(element, value, status, render_template, msg=''):
cols
=
element
.
get
(
'cols'
)
or
'80'
mode
=
element
.
get
(
'mode'
)
or
'python'
# mode for CodeMirror, eg "python" or "xml"
hidden
=
element
.
get
(
'hidden'
,
''
)
# if specified, then textline is hidden and id is stored in div of name given by hidden
linenumbers
=
element
.
get
(
'linenumbers'
)
# for CodeMirror
linenumbers
=
element
.
get
(
'linenumbers'
,
'true'
)
# for CodeMirror
if
not
value
:
value
=
element
.
text
# if no student input yet, then use the default input given by the problem
context
=
{
'id'
:
eid
,
'value'
:
value
,
'state'
:
status
,
'count'
:
count
,
'size'
:
size
,
'msg'
:
msg
,
'mode'
:
mode
,
'linenumbers'
:
linenumbers
,
...
...
common/lib/capa/capa/responsetypes.py
View file @
ada66adf
...
...
@@ -810,7 +810,8 @@ class CodeResponse(LoncapaResponse):
def
setup_response
(
self
):
xml
=
self
.
xml
self
.
url
=
xml
.
get
(
'url'
,
"http://ec2-50-16-59-149.compute-1.amazonaws.com/xqueue/submit/"
)
# FIXME -- hardcoded url
self
.
url
=
xml
.
get
(
'url'
,
"http://107.20.215.194/xqueue/submit/"
)
# FIXME -- hardcoded url
self
.
queue_name
=
xml
.
get
(
'queuename'
,
'python'
)
# TODO: Default queue_name should be course-specific
answer
=
xml
.
find
(
'answer'
)
if
answer
is
not
None
:
...
...
@@ -848,13 +849,13 @@ class CodeResponse(LoncapaResponse):
def
get_score
(
self
,
student_answers
):
try
:
submission
=
[
student_answers
[
self
.
answer_id
]
]
submission
=
student_answers
[
self
.
answer_id
]
except
Exception
as
err
:
log
.
error
(
'Error in CodeResponse
%
s: cannot get student answer for
%
s; student_answers=
%
s'
%
(
err
,
self
.
answer_id
,
student_answers
))
raise
Exception
(
err
)
self
.
context
.
update
({
'submission'
:
submission
})
extra_payload
=
{
'edX_student_response'
:
json
.
dumps
(
submission
)
}
extra_payload
=
{
'edX_student_response'
:
submission
}
r
,
queuekey
=
self
.
_send_to_queue
(
extra_payload
)
# TODO: Perform checks on the xqueue response
...
...
@@ -904,7 +905,9 @@ class CodeResponse(LoncapaResponse):
def
_send_to_queue
(
self
,
extra_payload
):
# Prepare payload
xmlstr
=
etree
.
tostring
(
self
.
xml
,
pretty_print
=
True
)
header
=
{
'return_url'
:
self
.
system
.
xqueue_callback_url
}
header
=
{
'return_url'
:
self
.
system
.
xqueue_callback_url
,
'queue_name'
:
self
.
queue_name
,
}
# Queuekey generation
h
=
hashlib
.
md5
()
...
...
@@ -913,13 +916,16 @@ class CodeResponse(LoncapaResponse):
queuekey
=
int
(
h
.
hexdigest
(),
16
)
header
.
update
({
'queuekey'
:
queuekey
})
payload
=
{
'xqueue_header'
:
json
.
dumps
(
header
),
# TODO: 'xqueue_header' should eventually be derived from a config file
'xml'
:
xmlstr
,
'edX_cmd'
:
'get_score'
,
'edX_tests'
:
self
.
tests
,
'processor'
:
self
.
code
,
body
=
{
'xml'
:
xmlstr
,
'edX_cmd'
:
'get_score'
,
'edX_tests'
:
self
.
tests
,
'processor'
:
self
.
code
,
}
body
.
update
(
extra_payload
)
payload
=
{
'xqueue_header'
:
json
.
dumps
(
header
),
'xqueue_body'
:
json
.
dumps
(
body
),
}
payload
.
update
(
extra_payload
)
# Contact queue server
try
:
...
...
common/lib/capa/capa/templates/textbox.html
View file @
ada66adf
...
...
@@ -34,7 +34,8 @@
%
if
linenumbers
==
'true'
:
lineNumbers
:
true
,
%
endif
mode
:
"${mode}"
mode
:
"${mode}"
,
tabsize
:
4
,
});
});
</script>
...
...
common/lib/xmodule/xmodule/capa_module.py
View file @
ada66adf
...
...
@@ -352,7 +352,7 @@ class CapaModule(XModule):
No ajax return is needed. Return empty dict.
"""
queuekey
=
get
[
'queuekey'
]
score_msg
=
get
[
'
response
'
]
score_msg
=
get
[
'
xqueue_body
'
]
self
.
lcp
.
update_score
(
score_msg
,
queuekey
)
return
dict
()
# No AJAX return is needed
...
...
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