import (re)captcha message factory for (re)captcha validation error. this fixes the strange type error.

svn path=/plone.app.discussion/trunk/; revision=29427
This commit is contained in:
Timo Stollenwerk 2009-08-28 08:28:58 +00:00
parent 72ac358c4c
commit 5cf3510dd9

View File

@ -16,15 +16,26 @@ from zope.schema import ValidationError
from plone.registry.interfaces import IRegistry from plone.registry.interfaces import IRegistry
from plone.app.discussion.interfaces import IDiscussionSettings, IDiscussionLayer, MessageFactory as _ from plone.app.discussion.interfaces import IDiscussionSettings, IDiscussionLayer
try:
from plone.formwidget.captcha import CaptchaMessageFactory as _
class WrongCaptchaCode(ValidationError):
__doc__ = _("""The code you entered was wrong, please enter the new one.""")
except:
pass
try:
from plone.formwidget.recaptcha import ReCaptchaMessageFactory as _
class WrongReCaptchaCode(ValidationError):
__doc__ = _("""The code you entered was wrong, please enter the new one.""")
except:
pass
from zope.interface import implements, Interface from zope.interface import implements, Interface
from zope.schema.interfaces import IField from zope.schema.interfaces import IField
from zope.component import adapts from zope.component import adapts
class WrongCaptchaCode(ValidationError):
__doc__ = _("""The code you entered was wrong, please enter the new one.""")
class CaptchaValidator(validator.SimpleFieldValidator): class CaptchaValidator(validator.SimpleFieldValidator):
implements(IValidator) implements(IValidator)
adapts(Interface,IDiscussionLayer,Interface,IField,Interface) adapts(Interface,IDiscussionLayer,Interface,IField,Interface)