Simplify the CaptchaValidator class by dynamically adapting a view with the name of the captcha plugin (e.g. recaptcha, captcha, akismet) for the validator.

svn path=/plone.app.discussion/trunk/; revision=37131
This commit is contained in:
Timo Stollenwerk
2010-06-10 10:51:41 +00:00
parent 30ffc4a920
commit 92766752c4
3 changed files with 20 additions and 18 deletions
+5 -1
View File
@@ -119,7 +119,11 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
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 = CaptchaValidator(self.context,
self.request,
None,
ICaptcha['captcha'],
None)
captcha.validate(data['captcha'])
else:
return