Thanks a lot for the key info!
I installed it and now am able to see captcha system working in my
project. Of course, I did some changes to the original _tg_example.py
to make it work properly. Not sure whether the changes were correct.
Mainly, I had to change the "process" routine like this:
-------------------------------
# Original #
@expose()
@validate(form=register__form)
@error_handler(index)
def process(self, tg_errors=None , **data):
engine.begin() # ???
captcha_key = cherrypy.session.get('register__captcha_key')
captcha_seed = cherrypy.session.get('register__captcha_seed')
if not self._validate_captcha( captcha_seed=captcha_seed ,
captcha_key_combined=captcha_key, user_guess=data['captcha_text'] ):
return dict( self.index( data ) )
# you'd want to continue here
--------------------------------------
# Changed #
@expose()
@validate(form=register__form)
@error_handler(index)
@exception_handler(index)
def process(self, **data):
captcha_key = cherrypy.session.get('register__captcha_key')
captcha_seed = cherrypy.session.get('register__captcha_seed')
if not self._validate_captcha( captcha_seed=captcha_seed ,
captcha_key_combined=captcha_key, user_guess=data['captcha_text']):
raise Exception("Captcha mismatch!")
# you'd want to continue here
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---