Commit 6f7f9245 by Arthur Barrett

replace bare except with except DoesNotExist

parent beabdf14
...@@ -150,7 +150,7 @@ def read(request, course_id, note_id): ...@@ -150,7 +150,7 @@ def read(request, course_id, note_id):
''' '''
try: try:
note = Note.objects.get(id=note_id) note = Note.objects.get(id=note_id)
except: except Note.DoesNotExist:
return ApiResponse(http_response=HttpResponse('', status=404), data=None) return ApiResponse(http_response=HttpResponse('', status=404), data=None)
if not note.user.id == request.user.id: if not note.user.id == request.user.id:
...@@ -165,7 +165,7 @@ def update(request, course_id, note_id): ...@@ -165,7 +165,7 @@ def update(request, course_id, note_id):
''' '''
try: try:
note = Note.objects.get(id=note_id) note = Note.objects.get(id=note_id)
except: except Note.DoesNotExist:
return ApiResponse(http_response=HttpResponse('', status=404), data=None) return ApiResponse(http_response=HttpResponse('', status=404), data=None)
if not note.user.id == request.user.id: if not note.user.id == request.user.id:
...@@ -191,7 +191,7 @@ def delete(request, course_id, note_id): ...@@ -191,7 +191,7 @@ def delete(request, course_id, note_id):
''' '''
try: try:
note = Note.objects.get(id=note_id) note = Note.objects.get(id=note_id)
except: except Note.DoesNotExist:
return ApiResponse(http_response=HttpResponse('', status=404), data=None) return ApiResponse(http_response=HttpResponse('', status=404), data=None)
if not note.user.id == request.user.id: if not note.user.id == request.user.id:
......
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