Making captcha validator only adapt for the appropriate browser layer. This fixes the captcha error issue when p.a.d is in a deployment but not installed yet.

Merge from r29239 from evilbungle-safe-html branch.

svn path=/plone.app.discussion/trunk/; revision=29248
This commit is contained in:
Timo Stollenwerk 2009-08-21 21:15:13 +00:00
parent 6bda1e3b3a
commit c83d826c46

View File

@ -16,12 +16,19 @@ from zope.schema import ValidationError
from plone.registry.interfaces import IRegistry
from plone.app.discussion.interfaces import IDiscussionSettings, MessageFactory as _
from plone.app.discussion.interfaces import IDiscussionSettings, IDiscussionLayer, MessageFactory as _
from zope.interface import implements, Interface
from zope.schema.interfaces import IField
from zope.component import adapts
class WrongCaptchaCode(ValidationError):
__doc__ = _("""The code you entered was wrong, please enter the new one.""")
class CaptchaValidator(validator.SimpleFieldValidator):
implements(IValidator)
adapts(Interface,IDiscussionLayer,Interface,IField,Interface)
# Object, Request, Form, Field, Widget,
def validate(self, value):
super(CaptchaValidator, self).validate(value)