Move type-checking of position earlier in courseware.views.index

This commit is contained in:
Calen Pennington
2015-03-27 14:23:13 -04:00
parent 85fce7e3b7
commit 8341f1b7c8

View File

@@ -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,