Last change
on this file since 2804 was
2804,
checked in by mylan, 14 years ago
|
#195: Fixed form breakage in plone-3.3
|
-
Property svn:eol-style set to
native
|
File size:
969 bytes
|
Rev | Line | |
---|
[2802] | 1 | from zope.schema import TextLine |
---|
| 2 | from zope.component import adapts |
---|
| 3 | from zope.interface import Interface, implements |
---|
[2804] | 4 | from zope.formlib.form import FormFields |
---|
| 5 | from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile |
---|
| 6 | from plone.app.form.base import EditForm |
---|
[2802] | 7 | |
---|
[2801] | 8 | from quintagroup.formlib.captcha import Captcha |
---|
| 9 | |
---|
| 10 | # Define CaptchaFormlibForm form schema |
---|
| 11 | |
---|
| 12 | class ICaptchaFormlibFormSchema(Interface): |
---|
| 13 | label = TextLine(title=u'Label') |
---|
| 14 | captcha = Captcha(title=u'Type the code') |
---|
| 15 | |
---|
| 16 | # Create adapter for any object to ICaptchaFormlibFormSchema |
---|
| 17 | # schema interface |
---|
| 18 | |
---|
| 19 | class CaptchaFormlibFormAdapter(object): |
---|
[2802] | 20 | implements(ICaptchaFormlibFormSchema) |
---|
[2803] | 21 | |
---|
| 22 | def __init__(self, context): |
---|
| 23 | self.context = context |
---|
| 24 | |
---|
[2801] | 25 | label = u'' |
---|
| 26 | captcha = None |
---|
| 27 | |
---|
| 28 | # And at the last define the CaptchaFormlibForm form |
---|
| 29 | |
---|
[2802] | 30 | class CaptchaFormlibForm(EditForm): |
---|
[2804] | 31 | template = ViewPageTemplateFile("example.pt") |
---|
[2802] | 32 | form_fields = FormFields(ICaptchaFormlibFormSchema) |
---|
Note: See
TracBrowser
for help on using the repository browser.