Silva Captcha and Formulator

Jonathan Bowlas <j.bowlas-hclig2XLE9Zaa/[email protected]> Tue, 13 Apr 2010 11:21:09 +0100
Newsgroups gmane.comp.web.zope.silva.devel
Message-ID <[email protected]>
Hi all,

I've created a form in formulator that uses the silva captcha product
but I'm having trouble getting it to validate.

The formulator form includes a string field for the captcha entry.
The form is rendered by a page template which includes the following
code to render the captcha image:

        <tal:captcha tal:define="captcha nocall:here/@@captcha"
        tal:content="structure captcha/image_tag">
        </tal:captcha>


The formulator string field for the captcha entry has an External
Validator like so:

from silva.captcha import validate
input = context.REQUEST.form.get('field_captcha', None)
if not validate(context, context.REQUEST, input):
  return 'false'
else:
  return 'true'


However this seems to validate no matter what value I enter into the
string field, whether it matches the captcha image or not. So I'm
doing something wrong here but I'm not sure what.

Any advice/help would be greatly appreciated.

Cheers

Jon