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
|
Rev | Line | |
---|
[2802] | 1 | from zope.schema import TextLine |
---|
| 2 | from zope.component import adapts |
---|
| 3 | from zope.interface import Interface, implements |
---|
| 4 | from zope.formlib.form import EditForm, FormFields |
---|
| 5 | |
---|
[2801] | 6 | from quintagroup.formlib.captcha import Captcha |
---|
| 7 | |
---|
| 8 | # Define CaptchaFormlibForm form schema |
---|
| 9 | |
---|
| 10 | class 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 | |
---|
| 17 | class 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] | 28 | class CaptchaFormlibForm(EditForm): |
---|
[2803] | 29 | |
---|
[2802] | 30 | form_fields = FormFields(ICaptchaFormlibFormSchema) |
---|
Note: See
TracBrowser
for help on using the repository browser.