# HG changeset patch # User neko259 # Date 2015-12-06 19:24:32 # Node ID acc799d1501d006d18c70b6984c7af4a9964345c # Parent 78342ab80a73e47f6405eea6059de12b7f9f719f If trying to get thread diff from a GET request, send a message instead of failing with exception diff --git a/boards/views/api.py b/boards/views/api.py --- a/boards/views/api.py +++ b/boards/views/api.py @@ -50,8 +50,12 @@ def api_get_threaddiff(request): """ thread_id = request.POST.get(PARAMETER_THREAD) - uids_str = request.POST.get(PARAMETER_UIDS).strip() - uids = uids_str.split(' ') + uids_str = request.POST.get(PARAMETER_UIDS) + + if not thread_id or not uids_str: + return HttpResponse(content='Invalid request.') + + uids = uids_str.strip().split(' ') opening_post = get_object_or_404(Post, id=thread_id) thread = opening_post.get_thread()