Move type-checking of position earlier in courseware.views.index
This commit is contained in:
@@ -345,6 +345,13 @@ def _index_bulk_op(request, course_key, chapter, section, position):
|
||||
"""
|
||||
Render the index page for the specified course.
|
||||
"""
|
||||
# Verify that position a string is in fact an int
|
||||
if position is not None:
|
||||
try:
|
||||
int(position)
|
||||
except ValueError:
|
||||
raise Http404("Position {} is not an integer!".format(position))
|
||||
|
||||
user = request.user
|
||||
course = get_course_with_access(user, 'load', course_key, depth=2)
|
||||
|
||||
@@ -493,13 +500,6 @@ def _index_bulk_op(request, course_key, chapter, section, position):
|
||||
section_descriptor, depth=None
|
||||
)
|
||||
|
||||
# Verify that position a string is in fact an int
|
||||
if position is not None:
|
||||
try:
|
||||
int(position)
|
||||
except ValueError:
|
||||
raise Http404("Position {} is not an integer!".format(position))
|
||||
|
||||
section_module = get_module_for_descriptor(
|
||||
request.user,
|
||||
request,
|
||||
|
||||
Reference in New Issue
Block a user