Changeset 3168 in products for quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/validator.py
- Timestamp:
- Apr 21, 2011 1:43:09 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/validator.py
r2852 r3168 2 2 from Products.validation import validation 3 3 from Products.validation.interfaces.IValidator import IValidator 4 from Products.CMFPlone.utils import safe_hasattr5 4 6 from config import PLONE_VERSION 5 from quintagroup.pfg.captcha.config import PLONE_VERSION 6 7 7 8 8 class CaptchaValidator: … … 19 19 def __call__(self, value, *args, **kwargs): 20 20 21 form 21 form = kwargs.get('instance') 22 22 portal = getToolByName(form, 'portal_url').getPortalObject() 23 23 result = portal.captcha_validator() 24 24 if result.status == 'failure': 25 return ("%(problem)s" % {'problem' 25 return ("%(problem)s" % {'problem': result.errors['key'][0]}) 26 26 else: 27 27 return 1
Note: See TracChangeset
for help on using the changeset viewer.