setup_data_locker.py
def create_fallback_adapter(form, recipient_email, recipient_name):
    """
    Creates a Mailer Adapter in the form (self) configured to send an encrypted
    email to the recipient (recipient_email, recipient_name).
    """
    template = \
"""Failed submission to the Data Locker

form_url: <tal:url tal:replace="python:context.aq_parent.absolute_url()" />
form_identifier: <tal:block tal:replace="python:context.aq_parent.id" />
name: <tal:block tal:replace="python:context.aq_parent.Title()" />
owner: <tal:block tal:replace="python:context.aq_parent.Creator()" />
timestamp: 
data: {
<tal:block repeat="field options/wrappedFields | nothing">"<tal:fieldset tal:condition="python:field.aq_parent.id != context.aq_parent.id"><tal:block tal:replace="python:field.aq_parent.Title()" /> / </tal:fieldset><tal:field tal:content="field/fgField/widget/label" />": "<tal:value tal:content="structure python:field.htmlValue(request)" />",</tal:block>
}
"""

    mailer = api.content.create(
        type='FormMailerAdapter',
        title='Failure Mailer',
        recipient_name=recipient_name,
        recipient_email=recipient_email,
        showAll=True,
        includeEmpties=True,
        body_pt=template,
        body_type='plain',
        gpg_keyid=recipient_email,
        container=form
        )
    mailer.msg_subject = 'Form Submission Failure'
    print "Fallback Mailer created at: %s" % mailer.absolute_url()
    active_adapters = set(list(form.actionAdapter))
    if mailer.id in active_adapters:
        active_adapters.remove(mailer.id)
    form.actionAdapter = list(active_adapters)
    print "Fallback Mailer deactivated"

    Creates a Mailer Adapter in the form (self) configured to send an encrypted
    email to the recipient (recipient_email, recipient_name).
    
Creates a Mailer Adapter in the form (self) configured to send an encrypted
email to the recipient (recipient_email, recipient_name).
Creates a Mailer Adapter in the form ( self ) configured to send an encrypted email to the recipient ( recipient_email recipient_name ) .
def create_fallback_adapter(form, recipient_email, recipient_name):
    template = \
"""Failed submission to the Data Locker
form_url: <tal:url tal:replace="python:context.aq_parent.absolute_url()" />
form_identifier: <tal:block tal:replace="python:context.aq_parent.id" />
name: <tal:block tal:replace="python:context.aq_parent.Title()" />
owner: <tal:block tal:replace="python:context.aq_parent.Creator()" />
timestamp: 
data: {
<tal:block repeat="field options/wrappedFields | nothing">"<tal:fieldset tal:condition="python:field.aq_parent.id != context.aq_parent.id"><tal:block tal:replace="python:field.aq_parent.Title()" /> / </tal:fieldset><tal:field tal:content="field/fgField/widget/label" />": "<tal:value tal:content="structure python:field.htmlValue(request)" />",</tal:block>
}
"""
    mailer = api.content.create(
        type='FormMailerAdapter',
        title='Failure Mailer',
        recipient_name=recipient_name,
        recipient_email=recipient_email,
        showAll=True,
        includeEmpties=True,
        body_pt=template,
        body_type='plain',
        gpg_keyid=recipient_email,
        container=form
        )
    mailer.msg_subject = 'Form Submission Failure'
    print "Fallback Mailer created at: %s" % mailer.absolute_url()
    active_adapters = set(list(form.actionAdapter))
    if mailer.id in active_adapters:
        active_adapters.remove(mailer.id)
    form.actionAdapter = list(active_adapters)
    print "Fallback Mailer deactivated"
def create_fallback_adapter ( form , recipient_email , recipient_name ) : template = """Failed submission to the Data Locker

form_url: <tal:url tal:replace="python:context.aq_parent.absolute_url()" />
form_identifier: <tal:block tal:replace="python:context.aq_parent.id" />
name: <tal:block tal:replace="python:context.aq_parent.Title()" />
owner: <tal:block tal:replace="python:context.aq_parent.Creator()" />
timestamp: 
data: {
<tal:block repeat="field options/wrappedFields | nothing">"<tal:fieldset tal:condition="python:field.aq_parent.id != context.aq_parent.id"><tal:block tal:replace="python:field.aq_parent.Title()" /> / </tal:fieldset><tal:field tal:content="field/fgField/widget/label" />": "<tal:value tal:content="structure python:field.htmlValue(request)" />",</tal:block>
}
""" mailer = api . content . create ( type = 'FormMailerAdapter' , title = 'Failure Mailer' , recipient_name = recipient_name , recipient_email = recipient_email , showAll = True , includeEmpties = True , body_pt = template , body_type = 'plain' , gpg_keyid = recipient_email , container = form ) mailer . msg_subject = 'Form Submission Failure' print "Fallback Mailer created at: %s" % mailer . absolute_url ( ) active_adapters = set ( list ( form . actionAdapter ) ) if mailer . id in active_adapters : active_adapters . remove ( mailer . id ) form . actionAdapter = list ( active_adapters ) print "Fallback Mailer deactivated"
Creates a Mailer Adapter in the form (self) configured to send an encrypted
email to the recipient (recipient_email, recipient_name).
Creates a Mailer Adapter in the form ( self ) configured to send an encrypted email to the recipient ( recipient_email recipient_name ) .
"""
    Creates a Mailer Adapter in the form (self) configured to send an encrypted
    email to the recipient (recipient_email, recipient_name).
    """
form
recipient_email
recipient_name