If you need to use captcha we strongly suggest outsourcing to recaptcha.net
It could not be easier. here is how to:
Example:
public_key='xxx' ### provided by recaptcha.net
private_key='xxx' ### provided by recaptcha.net
def index():
form=FORM(RECAPTCHA(request,public_key,private_key),INPUT(_type='submit'))
if form.accepts(request.vars,session): response.flash='done!'
elif form.errors.has_key('captcha'): response.flash='invalid capctha'
else: response.flash='some other error in your form'
return dict(form=form)
The RECAPTCHA helper works very much as the input helper but it always take (request,public_key,private_key) and validates itself. If it does no pass validation an error message is stored in form.errors['captcha'] but not displayed. It is up to the developer to display the error as appropriate.