Commit 2e325729 by kimth

Callback uses userid rather than username

parent cdaec1e6
...@@ -210,7 +210,7 @@ def get_module(user, request, location, student_module_cache, position=None): ...@@ -210,7 +210,7 @@ def get_module(user, request, location, student_module_cache, position=None):
# 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/' + user.username + '/' + descriptor.location.url() + '/' xqueue_callback_url = settings.MITX_ROOT_URL + '/xqueue/' + str(user.id) + '/' + descriptor.location.url() + '/'
def _get_module(location): def _get_module(location):
(module, _, _, _) = get_module(user, request, location, student_module_cache, position) (module, _, _, _) = get_module(user, request, location, student_module_cache, position)
...@@ -330,7 +330,7 @@ def add_histogram(module): ...@@ -330,7 +330,7 @@ def add_histogram(module):
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.models import User from django.contrib.auth.models import User
@csrf_exempt @csrf_exempt
def xqueue_callback(request, username, id, dispatch): def xqueue_callback(request, userid, id, dispatch):
# Parse xqueue response # Parse xqueue response
get = request.POST.copy() get = request.POST.copy()
try: try:
...@@ -340,7 +340,7 @@ def xqueue_callback(request, username, id, dispatch): ...@@ -340,7 +340,7 @@ def xqueue_callback(request, username, id, dispatch):
raise Exception(msg) raise Exception(msg)
# Retrieve target StudentModule # Retrieve target StudentModule
user = User.objects.get(username=username) user = User.objects.get(id=userid)
student_module_cache = StudentModuleCache(user, modulestore().get_item(id)) student_module_cache = StudentModuleCache(user, modulestore().get_item(id))
instance, instance_module, shared_module, module_type = get_module(request.user, request, id, student_module_cache) instance, instance_module, shared_module, module_type = get_module(request.user, request, id, student_module_cache)
......
...@@ -55,7 +55,7 @@ if settings.COURSEWARE_ENABLED: ...@@ -55,7 +55,7 @@ if settings.COURSEWARE_ENABLED:
url(r'^masquerade/', include('masquerade.urls')), url(r'^masquerade/', include('masquerade.urls')),
url(r'^jumpto/(?P<probname>[^/]+)/$', 'courseware.views.jump_to'), url(r'^jumpto/(?P<probname>[^/]+)/$', 'courseware.views.jump_to'),
url(r'^modx/(?P<id>.*?)/(?P<dispatch>[^/]*)$', 'courseware.module_render.modx_dispatch'), #reset_problem'), url(r'^modx/(?P<id>.*?)/(?P<dispatch>[^/]*)$', 'courseware.module_render.modx_dispatch'), #reset_problem'),
url(r'^xqueue/(?P<username>[^/]*)/(?P<id>.*?)/(?P<dispatch>[^/]*)$', 'courseware.module_render.xqueue_callback'), url(r'^xqueue/(?P<userid>[^/]*)/(?P<id>.*?)/(?P<dispatch>[^/]*)$', 'courseware.module_render.xqueue_callback'),
url(r'^change_setting$', 'student.views.change_setting'), url(r'^change_setting$', 'student.views.change_setting'),
url(r'^s/(?P<template>[^/]*)$', 'static_template_view.views.auth_index'), url(r'^s/(?P<template>[^/]*)$', 'static_template_view.views.auth_index'),
url(r'^book/(?P<page>[^/]*)$', 'staticbook.views.index'), url(r'^book/(?P<page>[^/]*)$', 'staticbook.views.index'),
......
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