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
RevLine 
[2802]1from zope.schema import TextLine
2from zope.component import adapts
3from zope.interface import Interface, implements
4from zope.formlib.form import EditForm, FormFields
5
[2801]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):
[2802]18    implements(ICaptchaFormlibFormSchema)
[2803]19
20    def __init__(self, context):
21        self.context = context
22
[2801]23    label = u''
24    captcha = None
25     
26# And at the last define the CaptchaFormlibForm form
27
[2802]28class CaptchaFormlibForm(EditForm):
[2803]29
[2802]30    form_fields = FormFields(ICaptchaFormlibFormSchema)
Note: See TracBrowser for help on using the repository browser.