diff --git a/CHANGES.txt b/CHANGES.txt index 813b6da..0e327a5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,9 @@ Changelog 1.0b7 (unreleased) ------------------ +* Captcha plugin support for collective.z3cform.norobots added. + [] + * Store dates in utc and not in local time. Display local time [do3cc] diff --git a/plone/app/discussion/browser/captcha.py b/plone/app/discussion/browser/captcha.py index 32b9298..4c09a91 100644 --- a/plone/app/discussion/browser/captcha.py +++ b/plone/app/discussion/browser/captcha.py @@ -67,6 +67,9 @@ class CaptchaExtender(extensible.FormExtender): elif self.captcha == 'recaptcha': from plone.formwidget.recaptcha import ReCaptchaFieldWidget self.form.fields['captcha'].widgetFactory = ReCaptchaFieldWidget + elif self.captcha == 'norobots': + from collective.z3cform.norobots import NorobotsFieldWidget + self.form.fields['captcha'].widgetFactory = NorobotsFieldWidget else: self.form.fields['captcha'].mode = interfaces.HIDDEN_MODE diff --git a/plone/app/discussion/browser/validator.py b/plone/app/discussion/browser/validator.py index ffacaa9..8a46bc7 100644 --- a/plone/app/discussion/browser/validator.py +++ b/plone/app/discussion/browser/validator.py @@ -44,7 +44,7 @@ class CaptchaValidator(validator.SimpleFieldValidator): registry = queryUtility(IRegistry) settings = registry.forInterface(IDiscussionSettings) - if settings.captcha == 'captcha' or settings.captcha == 'recaptcha': + if settings.captcha in ('captcha', 'recaptcha', 'norobots'): captcha = getMultiAdapter((aq_inner(self.context), self.request), name=settings.captcha) if not captcha.verify(input=value): diff --git a/plone/app/discussion/interfaces.py b/plone/app/discussion/interfaces.py index 66359ef..cae5509 100644 --- a/plone/app/discussion/interfaces.py +++ b/plone/app/discussion/interfaces.py @@ -58,8 +58,9 @@ class IDiscussionSettings(Interface): description=_(u"help_captcha", default=u"Use this setting to enable or disable Captcha " "validation for comments. Install " - "plone.formwidget.captcha or " - "plone.formwidget.recaptcha if there are no options " + "plone.formwidget.captcha, " + "plone.formwidget.recaptcha, collective.akismet, or " + "collective.z3cform.norobots if there are no options " "available."), required=True, default='disabled', diff --git a/plone/app/discussion/vocabularies.py b/plone/app/discussion/vocabularies.py index 973d042..293e5d5 100644 --- a/plone/app/discussion/vocabularies.py +++ b/plone/app/discussion/vocabularies.py @@ -25,6 +25,13 @@ try: except ImportError: pass +HAS_NOROBOTS = False +try: + import collective.z3cform.norobots + HAS_NOROBOTS = True +except ImportError: + pass + def captcha_vocabulary(context): """Vocabulary with all available captcha implementations. @@ -54,6 +61,14 @@ def captcha_vocabulary(context): value='akismet', token='akismet', title='Akismet')) + + + if HAS_NOROBOTS: + terms.append( + SimpleTerm( + value='norobots', + token='norobots', + title='Norobots')) return SimpleVocabulary(terms)