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
80b62bf0
Commit
80b62bf0
authored
Jul 30, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Serialize xqueue payload
parent
6631848b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
8 deletions
+16
-8
common/lib/capa/capa/inputtypes.py
+1
-0
common/lib/capa/capa/responsetypes.py
+13
-7
common/lib/capa/capa/templates/textbox.html
+2
-1
No files found.
common/lib/capa/capa/inputtypes.py
View file @
80b62bf0
...
...
@@ -317,6 +317,7 @@ def textbox(element, value, status, render_template, msg=''):
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
if
not
value
:
value
=
element
.
text
# if no student input yet, then use the default input given by the problem
if
linenumbers
is
None
:
linenumbers
=
'true'
context
=
{
'id'
:
eid
,
'value'
:
value
,
'state'
:
status
,
'count'
:
count
,
'size'
:
size
,
'msg'
:
msg
,
'mode'
:
mode
,
'linenumbers'
:
linenumbers
,
'rows'
:
rows
,
'cols'
:
cols
,
...
...
common/lib/capa/capa/responsetypes.py
View file @
80b62bf0
...
...
@@ -810,7 +810,7 @@ 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
answer
=
xml
.
find
(
'answer'
)
if
answer
is
not
None
:
...
...
@@ -904,7 +904,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'
:
'mitx-600x'
,
}
# Queuekey generation
h
=
hashlib
.
md5
()
...
...
@@ -913,11 +915,15 @@ 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
)
...
...
common/lib/capa/capa/templates/textbox.html
View file @
80b62bf0
...
...
@@ -34,7 +34,8 @@
%
if
linenumbers
==
'true'
:
lineNumbers
:
true
,
%
endif
mode
:
"${mode}"
mode
:
"${mode}"
,
tabsize
:
4
,
});
});
</script>
...
...
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