source: products/quintagroup.formlib.captcha/trunk/quintagroup/formlib/captcha/example.py @ 3605

Last change on this file since 3605 was 3124, checked in by vmaksymiv, 13 years ago

pylint fixes

  • Property svn:eol-style set to native
File size: 832 bytes
RevLine 
[2802]1from zope.schema import TextLine
2from zope.interface import Interface, implements
[2804]3from zope.formlib.form import FormFields
4from plone.app.form.base import EditForm
[2802]5
[2801]6from quintagroup.formlib.captcha import Captcha
[2810]7
[3121]8
[2801]9# Define CaptchaFormlibForm form schema
10class ICaptchaFormlibFormSchema(Interface):
[2807]11    label = TextLine(title=u'Label',
12                     required=False)
[2801]13    captcha = Captcha(title=u'Type the code')
[3121]14
15
[2801]16# Create adapter for any object to ICaptchaFormlibFormSchema
17# schema interface
18class CaptchaFormlibFormAdapter(object):
[2802]19    implements(ICaptchaFormlibFormSchema)
[2803]20
21    def __init__(self, context):
22        self.context = context
23
[2801]24    label = u''
25    captcha = None
[3121]26
27
[2801]28# And at the last define the CaptchaFormlibForm form
[2802]29class CaptchaFormlibForm(EditForm):
30    form_fields = FormFields(ICaptchaFormlibFormSchema)
Note: See TracBrowser for help on using the repository browser.