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
Line 
1from zope.schema import TextLine
2from zope.interface import Interface, implements
3from zope.formlib.form import FormFields
4from plone.app.form.base import EditForm
5
6from quintagroup.formlib.captcha import Captcha
7
8
9# Define CaptchaFormlibForm form schema
10class ICaptchaFormlibFormSchema(Interface):
11    label = TextLine(title=u'Label',
12                     required=False)
13    captcha = Captcha(title=u'Type the code')
14
15
16# Create adapter for any object to ICaptchaFormlibFormSchema
17# schema interface
18class CaptchaFormlibFormAdapter(object):
19    implements(ICaptchaFormlibFormSchema)
20
21    def __init__(self, context):
22        self.context = context
23
24    label = u''
25    captcha = None
26
27
28# And at the last define the CaptchaFormlibForm form
29class CaptchaFormlibForm(EditForm):
30    form_fields = FormFields(ICaptchaFormlibFormSchema)
Note: See TracBrowser for help on using the repository browser.