一个金字塔/变形小部件,实现了google-recaptcha小部件。
pyramid_recaptcha的Python项目详细描述
金字塔重述
Pyramid_recaptcha是Pyramid的一个deform小部件,实现了google recaptcha服务。见(https://developers.google.com/recaptcha/)
安装
从google获取公共和私有api密钥。https://developers.google.com/recaptcha/
在install-requires中添加cryptaid-recaptcha。 并在金字塔应用程序中编辑production.ini以添加:
pyramid.includes = ... pyramid_recaptcha pyramid_recaptcha.public_key = your_public_key pyramid_recaptcha.private_key = your_private_key
将小部件添加到表单:
import colander from pyramid_recaptcha import deferred_recaptcha_widget class MyForm(colander.MappingSchema): captcha = colander.SchemaNode(colander.String(), title='Verify you are human', widget=deferred_recaptcha_widget)
在呈现表单时绑定请求变量:
MyForm().bind(request=self.request)
更改日志
1.0.2(2016-12-08)
- 强制相对导入,修复python 3[miohtama]
1.0.1(2016-11-04)
- 修复将模板添加到搜索路径[institution]
1.0(2016-11-04)
- Initial version [instification]