Comments with formencode, recaptcha and htmlfill
Thanks to the automagic pylons provides, I was able to write my own custom validator for reCAPTCHA in very few lines. I might publish it later on.
I use formencode to validate the form with a simple *validate*-decorator pylons provides. For recaptcha, as said, I provided my own validator, and htmlfill refills the form fields if anything goes wrong.
But I ran into some problems deploying it to my public server. All I got from recaptcha was *verify-params-incorrect*. This was because my lighttpd is compiled with ipv6, and therefore it reports ipv4 addresses as ::ffff:xxx.xxx.xxx.xxx. This can be easily managed with
if remote_ip.begins_with("::ffff:"): remote_ip = remote_ip[7:]
Due to recaptcha seemingly not handling ipv6-addresses, I decided to give ipv6 users a free pass; they can post without filling out the captcha. Sadly there won't be that many as my provider does not support any ipv6-glue, but that's for another day.