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
This commit is contained in:
Timo Stollenwerk 2010-08-05 15:36:07 +00:00
parent 94e73b43a7
commit f72972844d
2 changed files with 14 additions and 12 deletions

View File

@ -1,12 +1,17 @@
Changelog Changelog
========= =========
1.0b6 (unreleased) 1.0b6 (2010-08-05)
------------------ ------------------
* Catch Type errors in indexers if object can not be adapted to IDiscussion * Catch Type errors in indexers if object can not be adapted to IDiscussion
[do3cc] [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) 1.0b5 (2010-07-16)
------------------ ------------------

View File

@ -111,17 +111,14 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
settings = registry.forInterface(IDiscussionSettings) settings = registry.forInterface(IDiscussionSettings)
portal_membership = getToolByName(self.context, 'portal_membership') portal_membership = getToolByName(self.context, 'portal_membership')
if settings.captcha != 'disabled' and portal_membership.isAnonymousUser(): if settings.captcha != 'disabled' and portal_membership.isAnonymousUser():
if 'captcha' in data: if not 'captcha' in data:
# Check Captcha only if there is a value, otherwise data['captcha'] = u""
# the default "required" validator is sufficient. captcha = CaptchaValidator(self.context,
captcha = CaptchaValidator(self.context, self.request,
self.request, None,
None, ICaptcha['captcha'],
ICaptcha['captcha'], None)
None) captcha.validate(data['captcha'])
captcha.validate(data['captcha'])
else:
return
if 'title' in data: if 'title' in data:
title = data['title'] title = data['title']