Ejemplo n.º 1
0
def get_student_profile_sub_unsub_link(handler, student, unused_course):
    email = student.email
    is_unsubscribed = unsubscribe.has_unsubscribed(email)

    # I18N: Control allowing user to subscribe/unsubscribe from email invitation
    sub_unsub_title = handler.gettext('Subscribe/Unsubscribe')
    sub_unsub_message = safe_dom.NodeList()

    if is_unsubscribed:
        resubscribe_url = unsubscribe.get_resubscribe_url(handler, email)
        sub_unsub_message.append(
            safe_dom.Text(
                # I18N: Message - user has unsubscribed from email invitations.
                handler.gettext(
                    'You are currently unsubscribed from course-related emails.'
                )))
        sub_unsub_message.append(
            safe_dom.A(resubscribe_url).add_text(
                # I18N: Control allowing user to re-subscribe to email invitations.
                handler.gettext('Click here to re-subscribe.')))
    else:
        unsubscribe_url = unsubscribe.get_unsubscribe_url(handler, email)
        sub_unsub_message.append(
            safe_dom.Text(
                # I18N: Text indicating user has opted in to email invitations.
                handler.gettext(
                    'You are currently receiving course-related emails. ')))
        sub_unsub_message.append(
            safe_dom.A(unsubscribe_url).add_text(
                # I18N: Control allowing user to unsubscribe from email invitations.
                handler.gettext('Click here to unsubscribe.')))

    return (sub_unsub_title, sub_unsub_message)
Ejemplo n.º 2
0
def get_student_profile_sub_unsub_link(handler, student, unused_course):
    email = student.email
    is_unsubscribed = unsubscribe.has_unsubscribed(email)

    # I18N: Control allowing user to subscribe/unsubscribe from email invitation
    sub_unsub_title = handler.gettext('Subscribe/Unsubscribe')
    sub_unsub_message = safe_dom.NodeList()

    if is_unsubscribed:
        resubscribe_url = unsubscribe.get_resubscribe_url(handler, email)
        sub_unsub_message.append(safe_dom.Text(
            # I18N: Message - user has unsubscribed from email invitations.
            handler.gettext(
                'You are currently unsubscribed from course-related emails.')))
        sub_unsub_message.append(safe_dom.A(resubscribe_url).add_text(
            # I18N: Control allowing user to re-subscribe to email invitations.
            handler.gettext('Click here to re-subscribe.')))
    else:
        unsubscribe_url = unsubscribe.get_unsubscribe_url(handler, email)
        sub_unsub_message.append(safe_dom.Text(
            # I18N: Text indicating user has opted in to email invitations.
            handler.gettext(
                'You are currently receiving course-related emails. ')))
        sub_unsub_message.append(safe_dom.A(unsubscribe_url).add_text(
            # I18N: Control allowing user to unsubscribe from email invitations.
            handler.gettext('Click here to unsubscribe.')))

    return (
        sub_unsub_title, sub_unsub_message)