def upgrade_1011_to_1012(context):

    # go through all email templates
    from seantis.reservation.mail_templates import templates
    template = templates['reservation_made']

    brains = utils.portal_type_in_site('seantis.reservation.emailtemplate')

    for tpl in (b.getObject() for b in brains):

        # and add the new email template in the correct language if available
        if template.is_translated(tpl.language):
            lang = tpl.language
        else:
            lang = 'en'

        tpl.reservation_made_subject = template.get_subject(lang)
        tpl.reservation_made_content = template.get_body(lang)
def upgrade_1011_to_1012(context):

    # go through all email templates
    from seantis.reservation.mail_templates import templates

    template = templates["reservation_made"]

    brains = utils.portal_type_in_site("seantis.reservation.emailtemplate")

    for tpl in (b.getObject() for b in brains):

        # and add the new email template in the correct language if available
        if template.is_translated(tpl.language):
            lang = tpl.language
        else:
            lang = "en"

        tpl.reservation_made_subject = template.get_subject(lang)
        tpl.reservation_made_content = template.get_body(lang)
Beispiel #3
0
def add_new_email_template(context, new_template):
    # go through all email templates

    from seantis.reservation.mail_templates import templates
    template = templates[new_template]

    brains = utils.portal_type_in_site('seantis.reservation.emailtemplate')

    for tpl in (b.getObject() for b in brains):

        # and add the new email template in the correct language if available
        if template.is_translated(tpl.language):
            lang = tpl.language
        else:
            lang = 'en'

        setattr(tpl, '{}_subject'.format(new_template),
                template.get_subject(lang))
        setattr(tpl, '{}_content'.format(new_template),
                template.get_body(lang))
Beispiel #4
0
def add_new_email_template(context, new_template):
    # go through all email templates

    from seantis.reservation.mail_templates import templates
    template = templates[new_template]

    brains = utils.portal_type_in_site('seantis.reservation.emailtemplate')

    for tpl in (b.getObject() for b in brains):

        # and add the new email template in the correct language if available
        if template.is_translated(tpl.language):
            lang = tpl.language
        else:
            lang = 'en'

        setattr(
            tpl, '{}_subject'.format(new_template), template.get_subject(lang)
        )
        setattr(
            tpl, '{}_content'.format(new_template), template.get_body(lang)
        )