diff options
-rw-r--r-- | askbot/forms.py | 2 | ||||
-rw-r--r-- | askbot/views/writers.py | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/askbot/forms.py b/askbot/forms.py index 645341aa..f85ffc50 100644 --- a/askbot/forms.py +++ b/askbot/forms.py @@ -1706,5 +1706,5 @@ class EditCommentForm(forms.Form): suppress_email = SuppressEmailField() -class DeleteCommentForm(forms.Form): +class ProcessCommentForm(forms.Form): comment_id = forms.IntegerField() diff --git a/askbot/views/writers.py b/askbot/views/writers.py index 4dc9e044..17c1db1c 100644 --- a/askbot/views/writers.py +++ b/askbot/views/writers.py @@ -819,7 +819,7 @@ def delete_comment(request): raise exceptions.PermissionDenied(msg) if request.is_ajax(): - form = forms.DeleteCommentForm(request.POST) + form = forms.ProcessCommentForm(request.POST) if form.is_valid() == False: return HttpResponseBadRequest() @@ -853,16 +853,14 @@ def delete_comment(request): @decorators.post_only def comment_to_answer(request): - try: - comment_id = int(request.POST.get('comment_id')) - except (ValueError, TypeError): - #type or value error is raised is int() fails + form = forms.ProcessCommentForm(request.POST) + if form.is_valid() == False: raise Http404 comment = get_object_or_404( models.Post, post_type='comment', - id=comment_id + id=form.cleaned_data['comment_id'] ) if askbot_settings.READ_ONLY_MODE_ENABLED is False: |