Commit e2f4995b by kimth

LMS provides fully qualified callback URL

parent 6d600ecf
...@@ -905,7 +905,7 @@ class CodeResponse(LoncapaResponse): ...@@ -905,7 +905,7 @@ class CodeResponse(LoncapaResponse):
def _send_to_queue(self, extra_payload): def _send_to_queue(self, extra_payload):
# Prepare payload # Prepare payload
xmlstr = etree.tostring(self.xml, pretty_print=True) xmlstr = etree.tostring(self.xml, pretty_print=True)
header = {'return_url': self.system.xqueue_callback_url, header = {'lms_callback_url': self.system.xqueue_callback_url,
'queue_name': self.queue_name, 'queue_name': self.queue_name,
} }
...@@ -914,7 +914,7 @@ class CodeResponse(LoncapaResponse): ...@@ -914,7 +914,7 @@ class CodeResponse(LoncapaResponse):
h.update(str(self.system.seed)) h.update(str(self.system.seed))
h.update(str(time.time())) h.update(str(time.time()))
queuekey = int(h.hexdigest(), 16) queuekey = int(h.hexdigest(), 16)
header.update({'queuekey': queuekey}) header.update({'lms_key': queuekey})
body = {'xml': xmlstr, body = {'xml': xmlstr,
'edX_cmd': 'get_score', 'edX_cmd': 'get_score',
......
...@@ -140,8 +140,11 @@ def get_module(user, request, location, student_module_cache, position=None): ...@@ -140,8 +140,11 @@ def get_module(user, request, location, student_module_cache, position=None):
# TODO (vshnayder): fix hardcoded urls (use reverse) # TODO (vshnayder): fix hardcoded urls (use reverse)
# Setup system context for module instance # Setup system context for module instance
ajax_url = settings.MITX_ROOT_URL + '/modx/' + descriptor.location.url() + '/' ajax_url = settings.MITX_ROOT_URL + '/modx/' + descriptor.location.url() + '/'
xqueue_callback_url = (settings.MITX_ROOT_URL + '/xqueue/' +
str(user.id) + '/' + descriptor.location.url() + '/') # Fully qualified callback URL for xqueue
xqueue_callback_url = (request.build_absolute_uri('/') + settings.MITX_ROOT_URL +
'xqueue/' + str(user.id) + '/' + descriptor.location.url() + '/' +
'score_update')
def _get_module(location): def _get_module(location):
(module, _, _, _) = get_module(user, request, location, (module, _, _, _) = get_module(user, request, location,
...@@ -202,8 +205,6 @@ def get_module(user, request, location, student_module_cache, position=None): ...@@ -202,8 +205,6 @@ def get_module(user, request, location, student_module_cache, position=None):
return (module, instance_module, shared_module, descriptor.category) return (module, instance_module, shared_module, descriptor.category)
# TODO: TEMPORARY BYPASS OF AUTH!
@csrf_exempt @csrf_exempt
def xqueue_callback(request, userid, id, dispatch): def xqueue_callback(request, userid, id, dispatch):
# Parse xqueue response # Parse xqueue response
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment