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

Last change on this file since 2803 was 2803, checked in by mylan, 14 years ago

#195: Fixed problem with breakage doctests

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