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
=========
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)
------------------

View File

@ -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']