Xqueue interface is embedded in ModuleSystem
This commit is contained in:
@@ -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(self.system.seed)
|
||||
xheader = xqueue_interface.make_xheader(lms_callback_url=self.system.xqueue_callback_url,
|
||||
queuekey = xqueue_interface.make_hashkey(str(self.system.seed)+self.answer_id)
|
||||
xheader = xqueue_interface.make_xheader(lms_callback_url=self.system.xqueue['callback_url'],
|
||||
lms_key=queuekey,
|
||||
queue_name=self.queue_name)
|
||||
|
||||
|
||||
@@ -112,3 +112,5 @@ class XqueueInterface:
|
||||
return (1, 'cannot connect to server')
|
||||
|
||||
return parse_xreply(r.text)
|
||||
|
||||
qinterface = XqueueInterface()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user