seems not an issue on recaptcha but on form being None. read the exception !

On Thursday, April 30, 2015 at 4:05:57 PM UTC+2, 黄祥 wrote:
>
> hi,
>
> i realized that recaptcha is not work in web2py latest version.
> e.g.
> def contact_us():
>     email = '[email protected] <javascript:>'
>     from gluon.tools import Recaptcha
>     form = SQLFORM(db.contact_us)
>
>
>
>
>
> *    form.element('table').insert(-1,TR('', Recaptcha(request,             
>                                          'PUBLIC_KEY',                     
>                                  'PRIVATE_KEY',                             
>                          error_message = 'invalid',                         
>                              label = 'Verify:',                             
>                          options = 'theme : "white", lang : "fr"'), ''))*
>     if form.process().accepted:
>         mail.send(email,
>                           'Contacted from %s' % request.env.http_host,
>                           '<html></html>' )
>         response.flash = T('messages sent')
>     elif form.errors:
>         response.flash = T('there is an error in the form')
>     else:
>         response.flash = T('please fill out the form')
>     return dict(form = form)
>
> *error*
> Version  web2py™ Version 2.10.4-stable+timestamp.2015.04.26.15.11.54  
> Python Python 2.7.8: C:\Python27\python.exe (prefix: C:\Python27)  
> Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 227, in restricted
>     exec ccode in environment
>   File "C:/web2py/applications/stifix/controllers/default.py" 
> <https://127.0.0.1/admin/default/edit/stifix/controllers/default.py>, line 
> 80, in <module>
>   File "C:\web2py\gluon\globals.py", line 393, in <lambda>
>     self._caller = lambda f: f()
>   File "C:/web2py/applications/stifix/controllers/default.py" 
> <https://127.0.0.1/admin/default/edit/stifix/controllers/default.py>, line 
> 78, in contact_us
>     return stifix_default.form_0(table, email, PUBLIC_KEY, PRIVATE_KEY)
>   File "applications\stifix\modules\stifix_default.py", line 35, in form_0
>     form.element('table').insert(-1,TR('', Recaptcha(current.request,
> AttributeError: 'NoneType' object has no attribute 'insert'
>
> Error snapshot [image: help] 
> <https://127.0.0.1/admin/default/ticket/stifix/127.0.0.1.2015-04-30.20-57-04.b6980bfe-c143-42c6-9a9f-66040a5141f0#>
>  
>
> <type 'exceptions.AttributeError'>('NoneType' object has no attribute 
> 'insert') 
> the same code run smoothly in 2.9.x version
> when i remove or commented the bold code, the error is disappeared yet the 
> captcha is not shown in the form.
> is there a way to make it work in web2py latest version?
>
> n.b.
> my public_key & private_key is not my real key in above code.
>
> thanks and best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to