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
96252aea
Commit
96252aea
authored
Aug 07, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #358 from MITx/kimth/lms-coderesponse
Kimth/lms coderesponse
parents
c79da581
05646fbe
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
14 deletions
+16
-14
common/lib/capa/capa/responsetypes.py
+9
-2
common/lib/capa/capa/util.py
+2
-2
common/lib/xmodule/xmodule/tests/__init__.py
+1
-1
common/lib/xmodule/xmodule/x_module.py
+1
-4
lms/djangoapps/courseware/module_render.py
+3
-5
No files found.
common/lib/capa/capa/responsetypes.py
View file @
96252aea
...
...
@@ -800,6 +800,12 @@ class CodeResponse(LoncapaResponse):
'''
Grade student code using an external queueing server, called 'xqueue'
Expects 'xqueue' dict in ModuleSystem with the following keys:
system.xqueue = { 'interface': XqueueInterface object,
'callback_url': Per-StudentModule callback URL where results are posted (string),
'default_queuename': Default queuename to submit request (string)
}
External requests are only submitted for student submission grading
(i.e. and not for getting reference answers)
'''
...
...
@@ -873,15 +879,16 @@ class CodeResponse(LoncapaResponse):
'edX_cmd'
:
'get_score'
,
'edX_tests'
:
self
.
tests
,
'processor'
:
self
.
code
,
'edX_student_response'
:
unicode
(
submission
),
# unicode on File object returns its filename
}
# Submit request
if
hasattr
(
submission
,
'read'
):
# Test for whether submission is a file
if
is_file
(
submission
):
contents
.
update
({
'edX_student_response'
:
submission
.
name
})
(
error
,
msg
)
=
qinterface
.
send_to_queue
(
header
=
xheader
,
body
=
json
.
dumps
(
contents
),
file_to_upload
=
submission
)
else
:
contents
.
update
({
'edX_student_response'
:
submission
})
(
error
,
msg
)
=
qinterface
.
send_to_queue
(
header
=
xheader
,
body
=
json
.
dumps
(
contents
))
...
...
common/lib/capa/capa/util.py
View file @
96252aea
...
...
@@ -39,13 +39,13 @@ def convert_files_to_filenames(answers):
'''
new_answers
=
dict
()
for
answer_id
in
answers
.
keys
():
if
is_
uploaded_
file
(
answers
[
answer_id
]):
if
is_file
(
answers
[
answer_id
]):
new_answers
[
answer_id
]
=
answers
[
answer_id
]
.
name
else
:
new_answers
[
answer_id
]
=
answers
[
answer_id
]
return
new_answers
def
is_
uploaded_
file
(
file_to_test
):
def
is_file
(
file_to_test
):
'''
Duck typing to check if 'file_to_test' is a File object
'''
...
...
common/lib/xmodule/xmodule/tests/__init__.py
View file @
96252aea
...
...
@@ -32,7 +32,7 @@ i4xs = ModuleSystem(
user
=
Mock
(),
filestore
=
fs
.
osfs
.
OSFS
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))),
debug
=
True
,
xqueue
=
{
'default_queuename'
:
'testqueue'
},
xqueue
=
{
'
interface'
:
None
,
'callback_url'
:
'/'
,
'
default_queuename'
:
'testqueue'
},
is_staff
=
False
)
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
96252aea
...
...
@@ -679,10 +679,7 @@ class ModuleSystem(object):
TODO (vshnayder): this will need to change once we have real user roles.
'''
self
.
ajax_url
=
ajax_url
if
xqueue
is
None
:
self
.
xqueue
=
{
'interface'
:
None
,
'callback_url'
:
'/'
,
'default_queuename'
:
'null'
}
else
:
self
.
xqueue
=
xqueue
self
.
xqueue
=
xqueue
self
.
track_function
=
track_function
self
.
filestore
=
filestore
self
.
get_module
=
get_module
...
...
lms/djangoapps/courseware/module_render.py
View file @
96252aea
...
...
@@ -252,7 +252,6 @@ def get_shared_instance_module(user, module, student_module_cache):
else
:
return
None
@csrf_exempt
def
xqueue_callback
(
request
,
userid
,
id
,
dispatch
):
'''
...
...
@@ -270,13 +269,12 @@ def xqueue_callback(request, userid, id, dispatch):
user
=
User
.
objects
.
get
(
id
=
userid
)
student_module_cache
=
StudentModuleCache
.
cache_for_descriptor_descendents
(
user
,
modulestore
()
.
get_item
(
id
))
instance
=
get_module
(
request
.
user
,
request
,
id
,
student_module_cache
)
instance_module
=
get_instance_module
(
request
.
user
,
instance
,
student_module_cache
)
instance
=
get_module
(
user
,
request
,
id
,
student_module_cache
)
instance_module
=
get_instance_module
(
user
,
instance
,
student_module_cache
)
if
instance_module
is
None
:
log
.
debug
(
"Couldn't find module '
%
s' for user '
%
s'"
,
id
,
request
.
user
)
id
,
user
)
raise
Http404
oldgrade
=
instance_module
.
grade
...
...
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