def __init__(self, oid, **kwargs):
        BaseFormField.__init__(self, oid, **kwargs)

        self.fgField = atapi.StringField('fg_product_price_field',
            searchable=False,
            required=False,
            write_permission=View,
            )
    def __init__(self, oid, **kwargs):
        BaseFormField.__init__(self, oid, **kwargs)

        # set a preconfigured field as an instance attribute
        self.fgField = StringField('fg_email_field',
            searchable=0,
            required=0,
            write_permission=View,
            #validators=('isNotTooLong',),
            )
    def __init__(self, oid, **kwargs):
        BaseFormField.__init__(self, oid, **kwargs)

        self.fgField = atapi.StringField('fg_product_select_field',
            searchable=False,
            required=False,
            widget=atapi.SelectionWidget(),
            vocabulary='_get_selection_vocabulary',
            enforceVocabulary=False,
            write_permission=View,
            )
    def fgPrimeDefaults(self, request, contextObject=None):
        """ primes request with default value"""

        BaseFormField.fgPrimeDefaults(self, request, contextObject)

        form_val = request.get(self.fgField.__name__, None)
        if form_val:
            self.fgField.tmp_value = form_val
        else:
            config = getMultiAdapter((self, request), name="maps_configuration")
            self.fgField.tmp_value = config.default_location
            request.form.setdefault(self.fgField.__name__, self.fgField.tmp_value)
    def __init__(self, oid, **kwargs):
        """ initialize class """
        BaseFormField.__init__(self, oid, **kwargs)

        # set a preconfigured field as an instance attribute
        self.fgField = StringField('fg_string_field',
            searchable=0,
            required=1,
            write_permission=View,
            #validators=('isNorobotsCorrect',),
            widget=NorobotsWidget(),
            )
    def __init__(self, oid, **kwargs):
        """ initialize class """

        BaseFormField.__init__(self, oid, **kwargs)

        self.fgField = BrFieldsAndWidgets.CPFField('fg_string_field',
            searchable=0,
            required=0,
            write_permission = View,
            widget=BrFieldsAndWidgets.CPFWidget(label=_(u'label_cpf'),
                                 description=_(u'desc_cpf')),
            )
Exemple #7
0
    def __init__(self, oid, **kwargs):
        """ initialize class """
        BaseFormField.__init__(self, oid, **kwargs)

        # set a preconfigured field as an instance attribute
        self.fgField = StringField('fg_string_field',
            searchable=0,
            required=1,
            write_permission=View,
            #validators=('isNorobotsCorrect',),
            widget=NorobotsWidget(),
            )
    def __init__(self, oid, **kwargs):
        """ initialize class """

        BaseFormField.__init__(self, oid, **kwargs)

        self.fgField = BrFieldsAndWidgets.CPFField(
            'fg_string_field',
            searchable=0,
            required=0,
            write_permission=View,
            widget=BrFieldsAndWidgets.CPFWidget(label=_(u'label_cpf'),
                                                description=_(u'desc_cpf')),
        )
Exemple #9
0
    def fgPrimeDefaults(self, request, contextObject=None):
        """ primes request with default value"""

        BaseFormField.fgPrimeDefaults(self, request, contextObject)

        form_val = request.get(self.fgField.__name__, None)
        if form_val:
            self.fgField.tmp_value = form_val
        else:
            config = getMultiAdapter((self, request),
                                     name="maps_configuration")
            self.fgField.tmp_value = config.default_location
            request.form.setdefault(self.fgField.__name__,
                                    self.fgField.tmp_value)
Exemple #10
0
    def __init__(self, oid, **kwargs):
        """ initialize class """

        BaseFormField.__init__(self, oid, **kwargs)

        # set a preconfigured field as an instance attribute
        self.fgField = PlainTextField(
            'fg_script_field',
            searchable=0,
            required=0,
            write_permission=permissions.View,
            validators=('isNotTooLong', ),
            default_content_type = 'text/plain',
            allowable_content_types = ('text/plain',),
            widget = JSWidget()
            )
    def __init__(self, oid, **kwargs):
        """ initialize class """

        BaseFormField.__init__(self, oid, **kwargs)

        # set a preconfigured field as an instance attribute
        self.fgField = DateTimeField('fg_ccexpirationdate_field',
            searchable=0,
            required=0,
            write_permission = View,
            widget=CalendarWidget(
                        macro="expirationdatecalendar",
                        show_hm=False,
                        format="%m-%Y",
                    ),
            )
Exemple #12
0
 def test_field_ids(self, aq_parent):
     item = self.createPFGExtendedMailAdapter()
     parent = mock.Mock()
     parent.contentValues.return_value = []
     aq_parent.return_value = parent
     self.assertEqual(item.field_ids(), [])
     parent.contentValues.return_value = [mock.Mock(), mock.Mock()]
     aq_parent.return_value = parent
     self.assertEqual(item.field_ids(), [])
     from Products.PloneFormGen.content.fieldsBase import BaseFormField
     parent.contentValues.return_value = [
         BaseFormField('field01'),
         BaseFormField('field02')
     ]
     aq_parent.return_value = parent
     self.assertEqual(item.field_ids(), ['field01', 'field02'])
    def __init__(self, oid, **kwargs):
        """ initialize class """

        BaseFormField.__init__(self, oid, **kwargs)

        # set a preconfigured field as an instance attribute
        self.fgField = StringVocabularyField(
            'fg_starrating_field',
            searchable=0,
            required=0,
            widget=atapi.SelectionWidget(
                macro="pfg_starrating"
            ),
            vocabulary='_get_selection_vocab',
            enforceVocabulary=1,
            write_permission=View,
        )