Use old deprecated form for instructor api calls, and in staff debug info

This commit is contained in:
Calen Pennington
2014-05-22 10:11:54 -04:00
parent 253ed3b855
commit 8699a13b09
9 changed files with 21 additions and 23 deletions

View File

@@ -118,7 +118,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.course.id,
'robot-some-problem-urlname'
)
self.problem_urlname = str(self.problem_location)
self.problem_urlname = self.problem_location.to_deprecated_string()
_module = StudentModule.objects.create(
student=self.user,
course_id=self.course.id,
@@ -1489,7 +1489,7 @@ class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase)
self.course.id,
'robot-some-problem-urlname'
)
self.problem_urlname = str(self.problem_location)
self.problem_urlname = self.problem_location.to_deprecated_string()
self.module_to_reset = StudentModule.objects.create(
student=self.student,
@@ -1749,7 +1749,7 @@ class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.course.id,
'robot-some-problem-urlname'
)
self.problem_urlname = str(self.problem_location)
self.problem_urlname = self.problem_location.to_deprecated_string()
self.module = StudentModule.objects.create(
student=self.student,

View File

@@ -61,7 +61,7 @@ class InstructorResetStudentStateTest(ModuleStoreTestCase, LoginEnrollmentTestCa
response = self.client.post(url, {
'action': 'Delete student state for module',
'unique_student_identifier': self.student.email,
'problem_for_student': str(problem_location),
'problem_for_student': problem_location.to_deprecated_string(),
})
self.assertEqual(response.status_code, 200)

View File

@@ -70,7 +70,6 @@ from .tools import (
)
from xmodule.modulestore import Location
from xmodule.modulestore.locations import SlashSeparatedCourseKey
from xmodule.modulestore.keys import UsageKey
from opaque_keys import InvalidKeyError
log = logging.getLogger(__name__)
@@ -768,7 +767,7 @@ def reset_student_attempts(request, course_id):
return HttpResponseForbidden("Requires instructor access.")
try:
module_state_key = UsageKey.from_string(problem_to_reset)
module_state_key = course_id.make_usage_key_from_deprecated_string(problem_to_reset)
except InvalidKeyError:
return HttpResponseBadRequest()
@@ -830,7 +829,7 @@ def rescore_problem(request, course_id):
)
try:
module_state_key = UsageKey.from_string(problem_to_reset)
module_state_key = course_id.make_usage_key_from_deprecated_string(problem_to_reset)
except InvalidKeyError:
return HttpResponseBadRequest("Unable to parse problem id")
@@ -933,7 +932,7 @@ def list_instructor_tasks(request, course_id):
if problem_location_str:
try:
module_state_key = UsageKey.from_string(problem_location_str)
module_state_key = course_id.make_usage_key_from_deprecated_string(problem_location_str)
except InvalidKeyError:
return HttpResponseBadRequest()
if student:

View File

@@ -33,7 +33,6 @@ from xmodule.modulestore.django import modulestore
from xmodule.modulestore.locations import SlashSeparatedCourseKey
from xmodule.modulestore.exceptions import ItemNotFoundError
from xmodule.html_module import HtmlDescriptor
from xmodule.modulestore.keys import UsageKey
from opaque_keys import InvalidKeyError
from lms.lib.xblock.runtime import quote_slashes
@@ -265,7 +264,7 @@ def instructor_dashboard(request, course_id):
elif "Rescore ALL students' problem submissions" in action:
problem_location_str = strip_if_string(request.POST.get('problem_for_all_students', ''))
try:
problem_location = UsageKey.from_string(problem_location_str)
problem_location = course_key.make_usage_key_from_deprecated_string(problem_location_str)
instructor_task = submit_rescore_problem_for_all_students(request, problem_location)
if instructor_task is None:
msg += '<font color="red">{text}</font>'.format(
@@ -301,7 +300,7 @@ def instructor_dashboard(request, course_id):
elif "Reset ALL students' attempts" in action:
problem_location_str = strip_if_string(request.POST.get('problem_for_all_students', ''))
try:
problem_location = UsageKey.from_string(problem_location_str)
problem_location = course_key.make_usage_key_from_deprecated_string(problem_location_str)
instructor_task = submit_reset_problem_attempts_for_all_students(request, problem_location)
if instructor_task is None:
msg += '<font color="red">{text}</font>'.format(
@@ -341,7 +340,7 @@ def instructor_dashboard(request, course_id):
else:
problem_location_str = strip_if_string(request.POST.get('problem_for_student', ''))
try:
problem_location = UsageKey.from_string(problem_location_str)
problem_location = course_key.make_usage_key_from_deprecated_string(problem_location_str)
except InvalidKeyError:
msg += '<font color="red">{text}</font>'.format(
text=_('Could not find problem location "{url}".').format(
@@ -355,7 +354,7 @@ def instructor_dashboard(request, course_id):
elif "Show Background Task History" in action:
problem_location = strip_if_string(request.POST.get('problem_for_all_students', ''))
try:
problem_location = UsageKey.from_string(problem_location_str)
problem_location = course_key.make_usage_key_from_deprecated_string(problem_location_str)
except InvalidKeyError:
msg += '<font color="red">{text}</font>'.format(
text=_('Could not find problem location "{url}".').format(
@@ -375,7 +374,7 @@ def instructor_dashboard(request, course_id):
)
problem_location_str = strip_if_string(request.POST.get('problem_for_student', ''))
try:
module_state_key = UsageKey.from_string(problem_location_str)
module_state_key = course_key.make_usage_key_from_deprecated_string(problem_location_str)
except InvalidKeyError:
msg += '<font color="red">{text}</font>'.format(
text=_('Could not find problem location "{url}".').format(