Use old deprecated form for instructor api calls, and in staff debug info
This commit is contained in:
@@ -258,7 +258,7 @@ class ViewsTestCase(TestCase):
|
||||
url = reverse('submission_history', kwargs={
|
||||
'course_id': self.course_key.to_deprecated_string(),
|
||||
'student_username': 'dummy',
|
||||
'location': unicode(self.component.location)
|
||||
'location': self.component.location.to_deprecated_string(),
|
||||
})
|
||||
response = self.client.get(url)
|
||||
# Tests that we do not get an "Invalid x" response when passing correct arguments to view
|
||||
|
||||
@@ -740,7 +740,7 @@ def submission_history(request, course_id, student_username, location):
|
||||
return HttpResponse(escape(_(u'Invalid course id.')))
|
||||
|
||||
try:
|
||||
usage_key = UsageKey.from_string(location)
|
||||
usage_key = course_key.make_usage_key_from_deprecated_string(location)
|
||||
except (InvalidKeyError, AssertionError):
|
||||
return HttpResponse(escape(_(u'Invalid location.')))
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -275,7 +275,7 @@ function goto( mode)
|
||||
</p>
|
||||
<p>
|
||||
${_("You should provide the full location of a problem. A location will look like this: {location}").format(
|
||||
location="<tt>location:edX+Open_DemoX+problem+78c98390884243b89f6023745231c525</tt>")
|
||||
location="<tt>i4x://edX/Open_DemoX/problem/78c98390884243b89f6023745231c525</tt>")
|
||||
}
|
||||
</p>
|
||||
<p>
|
||||
@@ -308,7 +308,7 @@ function goto( mode)
|
||||
</p>
|
||||
<p>
|
||||
${_("You should provide the full location of a problem. A location will look like this: {location}").format(
|
||||
location="<tt>location:edX+Open_DemoX+problem+78c98390884243b89f6023745231c525</tt>")
|
||||
location="<tt>i4x://edX/Open_DemoX/problem/78c98390884243b89f6023745231c525</tt>")
|
||||
}
|
||||
</p>
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
<p>
|
||||
${_("You should provide the full location of a problem. A location will look like this: {location}").format(
|
||||
location="<tt>location:edX+Open_DemoX+problem+78c98390884243b89f6023745231c525</tt>")
|
||||
location="<tt>i4x://edX/Open_DemoX/problem/78c98390884243b89f6023745231c525</tt>")
|
||||
}
|
||||
</p>
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
</p>
|
||||
<p>
|
||||
${_("You should provide the full location of a problem. A location will look like this: {location}").format(
|
||||
location="<tt>location:edX+Open_DemoX+problem+78c98390884243b89f6023745231c525</tt>")
|
||||
location="<tt>i4x://edX/Open_DemoX/problem/78c98390884243b89f6023745231c525</tt>")
|
||||
}
|
||||
</p>
|
||||
<p>
|
||||
|
||||
@@ -61,7 +61,7 @@ ${block_content}
|
||||
<label for="sd_fu_${location.name}">${_('Username')}:</label>
|
||||
<input type="text" id="sd_fu_${location.name}" placeholder="${user.username}"/>
|
||||
</div>
|
||||
<div data-location="${unicode(location)}" data-location-name="${location.name}">
|
||||
<div data-location="${location.to_deprecated_string()}" data-location-name="${location.name}">
|
||||
[
|
||||
<a href="#" id="staff-debug-reset" class="staff-debug-reset">${_('Reset Student Attempts')}</a>
|
||||
|
|
||||
@@ -75,7 +75,7 @@ ${block_content}
|
||||
|
||||
<div class="staff_info" style="display:block">
|
||||
is_released = ${is_released}
|
||||
location = ${location | h}
|
||||
location = ${location.to_deprecated_string() | h}
|
||||
<table summary="${_('Module Fields')}">
|
||||
<tr><th>${_('Module Fields')}</th></tr>
|
||||
%for name, field in fields:
|
||||
@@ -104,7 +104,7 @@ category = ${category | h}
|
||||
<form id="${element_id}_history_form">
|
||||
<label for="${element_id}_history_student_username">${_("User:")}</label>
|
||||
<input id="${element_id}_history_student_username" type="text" placeholder=""/>
|
||||
<input type="hidden" id="${element_id}_history_location" value="${location}"/>
|
||||
<input type="hidden" id="${element_id}_history_location" value="${location.to_deprecated_string()}"/>
|
||||
<div class="submit">
|
||||
<button name="submit" type="submit">${_("View History")}</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user