From f72972844d9f2bed62d7448ec6571a353110f6b6 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Thu, 5 Aug 2010 15:36:07 +0000 Subject: [PATCH] Call the CaptchaValidator even when no captcha data was submitted. This is necessary to ensure that the collective.akismet validator is called when installed. svn path=/plone.app.discussion/trunk/; revision=38541 --- CHANGES.txt | 7 ++++++- plone/app/discussion/browser/comments.py | 19 ++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 885b89f..aa2da65 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,12 +1,17 @@ Changelog ========= -1.0b6 (unreleased) +1.0b6 (2010-08-05) ------------------ * Catch Type errors in indexers if object can not be adapted to IDiscussion [do3cc] +* Call the CaptchaValidator even when no captcha data was submitted. This is + necessary to ensure that the collective.akismet validator is called when installed. + [timo] + + 1.0b5 (2010-07-16) ------------------ diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index 1a9f38a..e2494fb 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -111,17 +111,14 @@ class CommentForm(extensible.ExtensibleForm, form.Form): settings = registry.forInterface(IDiscussionSettings) portal_membership = getToolByName(self.context, 'portal_membership') if settings.captcha != 'disabled' and portal_membership.isAnonymousUser(): - if 'captcha' in data: - # Check Captcha only if there is a value, otherwise - # the default "required" validator is sufficient. - captcha = CaptchaValidator(self.context, - self.request, - None, - ICaptcha['captcha'], - None) - captcha.validate(data['captcha']) - else: - return + if not 'captcha' in data: + data['captcha'] = u"" + captcha = CaptchaValidator(self.context, + self.request, + None, + ICaptcha['captcha'], + None) + captcha.validate(data['captcha']) if 'title' in data: title = data['title']