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
41e7d72e
Commit
41e7d72e
authored
Aug 06, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Xqueue interface is embedded in ModuleSystem
parent
7cc502c8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
9 deletions
+17
-9
common/lib/capa/capa/responsetypes.py
+4
-4
common/lib/capa/capa/xqueue_interface.py
+2
-0
common/lib/xmodule/xmodule/x_module.py
+2
-3
lms/djangoapps/courseware/module_render.py
+9
-2
No files found.
common/lib/capa/capa/responsetypes.py
View file @
41e7d72e
...
...
@@ -29,7 +29,6 @@ import xqueue_interface
log
=
logging
.
getLogger
(
'mitx.'
+
__name__
)
qinterface
=
xqueue_interface
.
XqueueInterface
()
#-----------------------------------------------------------------------------
# Exceptions
...
...
@@ -811,7 +810,7 @@ class CodeResponse(LoncapaResponse):
def
setup_response
(
self
):
xml
=
self
.
xml
self
.
queue_name
=
xml
.
get
(
'queuename'
,
self
.
system
.
xqueue
_default_queuename
)
self
.
queue_name
=
xml
.
get
(
'queuename'
,
self
.
system
.
xqueue
[
'default_queuename'
]
)
answer
=
xml
.
find
(
'answer'
)
if
answer
is
not
None
:
...
...
@@ -859,10 +858,11 @@ class CodeResponse(LoncapaResponse):
# Prepare xqueue request
#------------------------------------------------------------
qinterface
=
self
.
system
.
xqueue
[
'interface'
]
# Generate header
queuekey
=
xqueue_interface
.
make_hashkey
(
s
elf
.
system
.
see
d
)
xheader
=
xqueue_interface
.
make_xheader
(
lms_callback_url
=
self
.
system
.
xqueue
_callback_url
,
queuekey
=
xqueue_interface
.
make_hashkey
(
s
tr
(
self
.
system
.
seed
)
+
self
.
answer_i
d
)
xheader
=
xqueue_interface
.
make_xheader
(
lms_callback_url
=
self
.
system
.
xqueue
[
'callback_url'
]
,
lms_key
=
queuekey
,
queue_name
=
self
.
queue_name
)
...
...
common/lib/capa/capa/xqueue_interface.py
View file @
41e7d72e
...
...
@@ -112,3 +112,5 @@ class XqueueInterface:
return
(
1
,
'cannot connect to server'
)
return
parse_xreply
(
r
.
text
)
qinterface
=
XqueueInterface
()
common/lib/xmodule/xmodule/x_module.py
View file @
41e7d72e
...
...
@@ -587,7 +587,7 @@ class ModuleSystem(object):
def
__init__
(
self
,
ajax_url
,
track_function
,
get_module
,
render_template
,
replace_urls
,
user
=
None
,
filestore
=
None
,
debug
=
False
,
xqueue
_callback_url
=
None
,
xqueue_default_queuename
=
"null"
):
xqueue
=
None
):
'''
Create a closure around the system environment.
...
...
@@ -615,8 +615,7 @@ class ModuleSystem(object):
ajax results.
'''
self
.
ajax_url
=
ajax_url
self
.
xqueue_callback_url
=
xqueue_callback_url
self
.
xqueue_default_queuename
=
xqueue_default_queuename
self
.
xqueue
=
xqueue
self
.
track_function
=
track_function
self
.
filestore
=
filestore
self
.
get_module
=
get_module
...
...
lms/djangoapps/courseware/module_render.py
View file @
41e7d72e
...
...
@@ -8,6 +8,7 @@ from django.views.decorators.csrf import csrf_exempt
from
django.contrib.auth.models
import
User
from
xmodule.modulestore.django
import
modulestore
from
capa.xqueue_interface
import
qinterface
from
mitxmako.shortcuts
import
render_to_string
from
models
import
StudentModule
,
StudentModuleCache
from
static_replace
import
replace_urls
...
...
@@ -151,6 +152,10 @@ def get_module(user, request, location, student_module_cache, position=None):
# TODO: Queuename should be derived from 'course_settings.json' of each course
xqueue_default_queuename
=
descriptor
.
location
.
org
+
'-'
+
descriptor
.
location
.
course
xqueue
=
{
'interface'
:
qinterface
,
'callback_url'
:
xqueue_callback_url
,
'default_queuename'
:
xqueue_default_queuename
.
replace
(
' '
,
'_'
)
}
def
_get_module
(
location
):
(
module
,
_
,
_
,
_
)
=
get_module
(
user
,
request
,
location
,
student_module_cache
,
position
)
...
...
@@ -162,8 +167,7 @@ def get_module(user, request, location, student_module_cache, position=None):
system
=
ModuleSystem
(
track_function
=
make_track_function
(
request
),
render_template
=
render_to_string
,
ajax_url
=
ajax_url
,
xqueue_callback_url
=
xqueue_callback_url
,
xqueue_default_queuename
=
xqueue_default_queuename
.
replace
(
' '
,
'_'
),
xqueue
=
xqueue
,
# TODO (cpennington): Figure out how to share info between systems
filestore
=
descriptor
.
system
.
resources_fs
,
get_module
=
_get_module
,
...
...
@@ -214,6 +218,9 @@ def get_module(user, request, location, student_module_cache, position=None):
@csrf_exempt
def
xqueue_callback
(
request
,
userid
,
id
,
dispatch
):
'''
Entry point for graded results from the queueing system.
'''
# Parse xqueue response
get
=
request
.
POST
.
copy
()
try
:
...
...
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