Пример #1
0
def send_event_reminder_message(event):
    share = event.share
    receivers = [share.educator, share.community_partner]
    other_users = [share.community_partner, share.educator]
    from_address = config.DONOTREPLY_EMAIL_ADDRESS
    event_details = EVENT_EDIT_TEMPLATE.format(event=event)
    url = share.conversation.get_url()
    subject = 'Reminder for Share on {}'.format(
        time_format.to_pretty(event.datetime_start))
    error_messages = []
    for receiver, other_user in zip(receivers, other_users):
        content = EVENT_REMINDER_TEMPLATE.format(
            share=share, eventdetails=event_details, url=url,
            other_user=other_user)
        to_address = receiver.confirmed_email
        if not to_address:
            logger.warning('Will not send event reminder to unconfirmed email address.')
            error_message = '{0} is not a confirmed email address'.format(
                receiver.email)
        else:
            email = mail.Email(
                from_address=from_address,
                to_address=to_address,
                subject=subject,
                content=content,
                new_content=content
            )
            error_message = mail.get_mailer().send(email)
        error_messages.append(error_message)
    combined_error_message = ', '.join(
        [e for e in error_messages if e is not None])
    return combined_error_message
Пример #2
0
def send_event_reminder_message(event):
    share = event.share
    receivers = [share.educator, share.community_partner]
    other_users = [share.community_partner, share.educator]
    from_address = config.DONOTREPLY_EMAIL_ADDRESS
    event_details = EVENT_EDIT_TEMPLATE.render(event=event)
    url = share.conversation.get_url()
    subject = 'Reminder for Share on {}'.format(
        time_format.to_pretty(event.datetime_start))
    error_messages = []
    for receiver, other_user in zip(receivers, other_users):
        content = EVENT_REMINDER_TEMPLATE.render(
            share=share,
            eventdetails=event_details,
            url=url,
            other_user=other_user,
        )
        to_address = receiver.confirmed_email
        if not to_address:
            logger.warning(
                'Will not send event reminder to unconfirmed email address.')
            error_message = '{0} is not a confirmed email address'.format(
                receiver.email)
        else:
            email = mail.Email(from_address=from_address,
                               to_address=to_address,
                               subject=subject,
                               content=content,
                               new_content=content)
            error_message = mail.get_mailer().send(email)
        error_messages.append(error_message)
    combined_error_message = ', '.join(
        [e for e in error_messages if e is not None])
    return combined_error_message
Пример #3
0
 def formatted_datetime_stop(self):
     return time_format.to_pretty(self.datetime_stop)
Пример #4
0
 def formatted_datetime_stop(self):
     return time_format.to_pretty(self.datetime_stop)