- if not user.is_authenticated() or (user.reputation < settings.REP_TO_FOR_NO_SPAM_CHECK and not user.is_staff and not user.is_superuser):
- if api.comment_check(comment, data):
- if request.is_ajax():
- response = {
- 'success': False,
- 'error_message': _("Sorry, but akismet thinks your %s is spam.") % comment_type
- }
- return HttpResponse(simplejson.dumps(response), mimetype="application/json")
- else:
+ if api.comment_check(comment, data):
+ post_data = request.POST
+ captcha_form = SimpleCaptchaForm(request.POST)
+
+ if request.is_ajax():
+ response = {
+ 'success': False,
+ 'error_message': _("Sorry, but akismet thinks your %s is spam.") % comment_type
+ }
+ return HttpResponse(json.dumps(response), mimetype="application/json")
+ else:
+ captcha_checked = False
+ try:
+ if captcha_form.is_valid() and 'recaptcha' in captcha_form.fields.keys():
+ captcha_checked = True
+ except:
+ pass
+
+ if not captcha_checked: