Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
8699a13b
Commit
8699a13b
authored
May 22, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use old deprecated form for instructor api calls, and in staff debug info
parent
253ed3b8
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
21 additions
and
23 deletions
+21
-23
lms/djangoapps/courseware/tests/test_views.py
+1
-1
lms/djangoapps/courseware/views.py
+1
-1
lms/djangoapps/instructor/tests/test_api.py
+3
-3
lms/djangoapps/instructor/tests/test_legacy_reset.py
+1
-1
lms/djangoapps/instructor/views/api.py
+3
-4
lms/djangoapps/instructor/views/legacy.py
+5
-6
lms/templates/courseware/instructor_dashboard.html
+2
-2
lms/templates/instructor/instructor_dashboard_2/student_admin.html
+2
-2
lms/templates/staff_problem_info.html
+3
-3
No files found.
lms/djangoapps/courseware/tests/test_views.py
View file @
8699a13b
...
...
@@ -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
...
...
lms/djangoapps/courseware/views.py
View file @
8699a13b
...
...
@@ -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.'
)))
...
...
lms/djangoapps/instructor/tests/test_api.py
View file @
8699a13b
...
...
@@ -118,7 +118,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
course
.
id
,
'robot-some-problem-urlname'
)
self
.
problem_urlname
=
s
tr
(
self
.
problem_location
)
self
.
problem_urlname
=
s
elf
.
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
=
s
tr
(
self
.
problem_location
)
self
.
problem_urlname
=
s
elf
.
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
=
s
tr
(
self
.
problem_location
)
self
.
problem_urlname
=
s
elf
.
problem_location
.
to_deprecated_string
(
)
self
.
module
=
StudentModule
.
objects
.
create
(
student
=
self
.
student
,
...
...
lms/djangoapps/instructor/tests/test_legacy_reset.py
View file @
8699a13b
...
...
@@ -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
)
...
...
lms/djangoapps/instructor/views/api.py
View file @
8699a13b
...
...
@@ -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
:
...
...
lms/djangoapps/instructor/views/legacy.py
View file @
8699a13b
...
...
@@ -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
(
...
...
lms/templates/courseware/instructor_dashboard.html
View file @
8699a13b
...
...
@@ -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>
...
...
lms/templates/instructor/instructor_dashboard_2/student_admin.html
View file @
8699a13b
...
...
@@ -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>
...
...
lms/templates/staff_problem_info.html
View file @
8699a13b
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment