source: products/qPloneCaptchaField/trunk/content/CaptchaField.py @ 1

Last change on this file since 1 was 1, checked in by myroslav, 18 years ago

Building directory structure

  • Property svn:eol-style set to native
File size: 990 bytes
Line 
1from Products.CMFCore.permissions import View
2
3from Products.Archetypes.atapi import *
4from Products.ATContentTypes.content.base import registerATCT
5
6from Products.PloneFormGen.content.fieldsBase import BaseFormField, BaseFieldSchemaStringDefault
7from Products.PloneFormGen.content.fields import FGStringField
8
9from Products.qPloneCaptchaField.config import PROJECTNAME
10from Products.qPloneCaptchaField.widgets.CaptchaWidget import CaptchaWidget
11
12class CaptchaField(FGStringField):
13
14    schema = BaseFieldSchemaStringDefault
15
16    def __init__(self, oid, **kwargs):
17        """ initialize class """
18
19        BaseFormField.__init__(self, oid, **kwargs)
20
21        # set a preconfigured field as an instance attribute
22        self.fgField = StringField('fg_string_field',
23            searchable=0,
24            required=1,
25            write_permission = View,
26            validators=('isCaptchaCorrect',),
27            widget=CaptchaWidget(),
28            )
29
30registerATCT(CaptchaField, PROJECTNAME)
Note: See TracBrowser for help on using the repository browser.