Commit 4bec871b by Calen Pennington

Don't return BadRequest classes, return instances

parent 8e0d218c
...@@ -57,7 +57,7 @@ def update_course_updates(location, update, passed_id=None): ...@@ -57,7 +57,7 @@ def update_course_updates(location, update, passed_id=None):
try: try:
course_updates = modulestore('direct').get_item(location) course_updates = modulestore('direct').get_item(location)
except ItemNotFoundError: except ItemNotFoundError:
return HttpResponseBadRequest return HttpResponseBadRequest()
# purely to handle free formed updates not done via editor. Actually kills them, but at least doesn't break. # purely to handle free formed updates not done via editor. Actually kills them, but at least doesn't break.
try: try:
...@@ -95,12 +95,12 @@ def delete_course_update(location, update, passed_id): ...@@ -95,12 +95,12 @@ def delete_course_update(location, update, passed_id):
Returns the resulting course_updates b/c their ids change. Returns the resulting course_updates b/c their ids change.
""" """
if not passed_id: if not passed_id:
return HttpResponseBadRequest return HttpResponseBadRequest()
try: try:
course_updates = modulestore('direct').get_item(location) course_updates = modulestore('direct').get_item(location)
except ItemNotFoundError: except ItemNotFoundError:
return HttpResponseBadRequest return HttpResponseBadRequest()
# TODO use delete_blank_text parser throughout and cache as a static var in a class # TODO use delete_blank_text parser throughout and cache as a static var in a class
# purely to handle free formed updates not done via editor. Actually kills them, but at least doesn't break. # purely to handle free formed updates not done via editor. Actually kills them, but at least doesn't break.
......
...@@ -204,7 +204,7 @@ def edit_subsection(request, location): ...@@ -204,7 +204,7 @@ def edit_subsection(request, location):
# make sure that location references a 'sequential', otherwise return BadRequest # make sure that location references a 'sequential', otherwise return BadRequest
if item.location.category != 'sequential': if item.location.category != 'sequential':
return HttpResponseBadRequest return HttpResponseBadRequest()
parent_locs = modulestore().get_parent_locations(location) parent_locs = modulestore().get_parent_locations(location)
...@@ -1021,7 +1021,7 @@ def module_info(request, module_location): ...@@ -1021,7 +1021,7 @@ def module_info(request, module_location):
elif real_method == 'POST' or real_method == 'PUT': elif real_method == 'POST' or real_method == 'PUT':
return HttpResponse(json.dumps(set_module_info(get_modulestore(location), location, request.POST)), mimetype="application/json") return HttpResponse(json.dumps(set_module_info(get_modulestore(location), location, request.POST)), mimetype="application/json")
else: else:
return HttpResponseBadRequest return HttpResponseBadRequest()
@login_required @login_required
@ensure_csrf_cookie @ensure_csrf_cookie
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment