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
501f2ccf
Commit
501f2ccf
authored
Aug 07, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CodeResponse uses 'is_file' helper function
parent
f6202e56
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
common/lib/capa/capa/responsetypes.py
+9
-2
common/lib/capa/capa/util.py
+2
-2
No files found.
common/lib/capa/capa/responsetypes.py
View file @
501f2ccf
...
...
@@ -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 @
501f2ccf
...
...
@@ -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
'''
...
...
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