raise AkismetReject if Akismet rejects a comment as spam.
svn path=/plone.app.discussion/trunk/; revision=37276
This commit is contained in:
parent
ac84b232b8
commit
e56bc65956
@ -33,6 +33,11 @@ try:
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
from collective.akismet.browser.validator import AkismetReject
|
||||
except:
|
||||
pass
|
||||
|
||||
from zope.interface import implements, Interface
|
||||
from zope.schema.interfaces import IField
|
||||
from zope.component import adapts
|
||||
@ -56,6 +61,9 @@ class CaptchaValidator(validator.SimpleFieldValidator):
|
||||
captcha = getMultiAdapter((aq_inner(self.context), self.request),
|
||||
name=settings.captcha)
|
||||
if not captcha.verify(input=value):
|
||||
if settings.captcha == 'akismet':
|
||||
raise AkismetReject
|
||||
else:
|
||||
raise WrongCaptchaCode
|
||||
else:
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user