def post_validate(self, REQUEST=None, errors=None): # Perform a check after validation. We do not want to make # plain_mail and html_mail required, but we do need at least # one of them filled. if (not REQUEST.form.get('plain_mail').strip() and not REQUEST.form.get('html_mail').strip()): error_message = _((u"You must specify either a plain text or " u"html mail (or both).")) if 'plain_mail' not in errors: errors['plain_mail'] = error_message if 'html_mail' not in errors: errors['html_mail'] = error_message
from collective.confirmableforms.mailer import simple_send_mail from collective.confirmableforms.utils import obj_to_pobj from collective.depositbox.store import Box from Products.Archetypes import atapi from Products.CMFCore import permissions from Products.PloneFormGen.content.formMailerAdapter import FormMailerAdapter from Products.PloneFormGen.content.formMailerAdapter import formMailerAdapterSchema # noqa from Products.TemplateFields import ZPTField as ZPTField confirmedSchema = atapi.Schema(( atapi.StringField( 'title_mail', required=True, widget=atapi.StringWidget( label=_(u'label_title_mail', default=u'Subject for the confirmation e-mail'), ), schemata='confirmation' ), atapi.StringField( 'sender_mail', required=False, widget=atapi.StringWidget( label=_( u'label_sender_mail', default=u'From address used to send the confirmation e-mail'), ), schemata='confirmation' ),
from Products.CMFCore import permissions from Products.PloneFormGen.config import EDIT_ADDRESSING_PERMISSION from Products.PloneFormGen.config import EDIT_ADVANCED_PERMISSION from Products.PloneFormGen.config import EDIT_TALES_PERMISSION from Products.PloneFormGen.content.formMailerAdapter import FormMailerAdapter from Products.PloneFormGen.content.formMailerAdapter import formMailerAdapterSchema # noqa from Products.TALESField import TALESString from Products.TemplateFields import ZPTField as ZPTField from zope.interface import implementer confirmedSchema = atapi.Schema(( atapi.StringField( 'title_mail', required=True, widget=atapi.StringWidget( label=_(u'label_title_mail', default=u'Subject for the confirmation e-mail')), schemata='confirmation', ), atapi.StringField( 'confirmation_recipient_email', searchable=0, required=0, default_method='getDefaultRecipient', write_permission=EDIT_ADDRESSING_PERMISSION, read_permission=permissions.ModifyPortalContent, validators=('isEmail', ), widget=atapi.StringWidget( label=_(u'label_recipient_email', default=u"Confirmation recipient's e-mail address"), description=_( u'help_recipient_email',