示例#1
0
 def test_multiple_recipients(self):
     """Function should send with multiple recipients listed"""
     count = len(mail.outbox)
     send_orb_email(
         recipients=["*****@*****.**", "*****@*****.**"],
         template_html="orb/email/password_reset.html",
         template_text="orb/email/password_reset.txt",
         subject="Tu contraseña ha sido restablecida.",
     )
     self.assertEqual(count + 1, len(mail.outbox))
示例#2
0
def send_resource_approved_email(resource):
    return send_orb_email(
        template_html="orb/email/resource_approved.html",
        template_text="orb/email/resource_approved.txt",
        subject=_(u"Resource Submission") + ": " + resource.title,
        recipients=[resource.create_user.email],
        title=resource.title,
        firstname=resource.create_user.first_name,
        lastname=resource.create_user.last_name,
        info_email=settings.ORB_INFO_EMAIL,
        resource_link=reverse_fqdn('orb_resource', resource.slug),
    )
示例#3
0
def send_resource_approved_email(resource):
    return send_orb_email(
        template_html="orb/email/resource_approved.html",
        template_text="orb/email/resource_approved.txt",
        subject=_(u"Resource Submission") + ": " + resource.title,
        recipients=[resource.create_user.email],
        title=resource.title,
        firstname=resource.create_user.first_name,
        lastname=resource.create_user.last_name,
        info_email=settings.ORB_INFO_EMAIL,
        resource_link=reverse_fqdn('orb_resource', resource.slug),
    )
示例#4
0
def send_peer_sync_notification_email(peer, **kwargs):
    """
    Sends an email to staff recipients that the peer was synced and a
    summary of updated resource counts.

    kwargs should includ3 new_resource_count and updated_resource_count
    """
    return send_orb_email(template_html="orb/email/api_resources_updated.html",
                          template_text="orb/email/api_resources_updated.txt",
                          subject=_("Peer Sync Complete") + ": " + peer.name,
                          recipients=[settings.ORB_INFO_EMAIL],
                          peer=peer,
                          **kwargs)
示例#5
0
def send_resource_rejected_email(resource):
    return send_orb_email(
        template_html="orb/email/resource_rejected.html",
        template_text="orb/email/resource_rejected.txt",
        subject=_(u"Resource Submission") + ": " + resource.title,
        recipients=[resource.create_user.email],
        title=resource.title,
        firstname=resource.create_user.first_name,
        lastname=resource.create_user.last_name,
        info_email=settings.ORB_INFO_EMAIL,
        resource_link=reverse_fqdn('orb_resource', resource.slug),
        notes=resource.workflow_trackers.rejected().notes(),
        rejected_criteria=unmet_criteria(resource),
    )
示例#6
0
def send_resource_rejected_email(resource):
    return send_orb_email(
        template_html="orb/email/resource_rejected.html",
        template_text="orb/email/resource_rejected.txt",
        subject=_(u"Resource Submission") + ": " + resource.title,
        recipients=[resource.create_user.email],
        title=resource.title,
        firstname=resource.create_user.first_name,
        lastname=resource.create_user.last_name,
        info_email=settings.ORB_INFO_EMAIL,
        resource_link=reverse_fqdn('orb_resource', resource.slug),
        notes=resource.workflow_trackers.rejected().notes(),
        rejected_criteria=unmet_criteria(resource),
    )
示例#7
0
def send_review_complete_email(resource, **kwargs):
    """
    Sends an email to staff recipients that all reviews for the given
    resource have been completed.
    """
    return send_orb_email(
        template_html="orb/email/review_complete.html",
        template_text="orb/email/review_complete.txt",
        subject=_(u"Resource Review Complete") + ": " + resource.title,
        recipients=[settings.ORB_INFO_EMAIL],
        title=resource.title,
        firstname=resource.create_user.first_name,
        lastname=resource.create_user.last_name,
        resource_link=reverse_fqdn('orb_staff_review', resource.pk),
        resource=resource,
        **kwargs)
示例#8
0
def send_review_complete_email(resource, **kwargs):
    """
    Sends an email to staff recipients that all reviews for the given
    resource have been completed.
    """
    return send_orb_email(
        template_html="orb/email/review_complete.html",
        template_text="orb/email/review_complete.txt",
        subject=_(u"Resource Review Complete") + ": " + resource.title,
        recipients=[settings.ORB_INFO_EMAIL],
        title=resource.title,
        firstname=resource.create_user.first_name,
        lastname=resource.create_user.last_name,
        resource_link=reverse_fqdn('orb_staff_review', resource.pk),
        resource=resource,
        **kwargs
    )
示例#9
0
def send_review_reminder_email(review):
    """

    Args:
        review: a ContentReview

    Returns:
        result of `send_mail` - 1 or 0

    """
    return send_orb_email(
        template_html="orb/email/review_reminder.html",
        template_text="orb/email/review_reminder.txt",
        subject=_(u"Resource review reminder: ") + unicode(review.resource),
        recipients=[review.reviewer.email],
        reviewer_name=review.reviewer.get_full_name(),
        resource_title=review.resource.title,
        review=review,
        review_age_days=7,
        reviews_link=reverse_fqdn('orb_user_reviews'),
    )
示例#10
0
def send_review_reminder_email(review):
    """

    Args:
        review: a ContentReview

    Returns:
        result of `send_mail` - 1 or 0

    """
    return send_orb_email(
        template_html="orb/email/review_reminder.html",
        template_text="orb/email/review_reminder.txt",
        subject=_(u"Resource review reminder: ") + unicode(review.resource),
        recipients=[review.reviewer.email],
        reviewer_name=review.reviewer.get_full_name(),
        resource_title=review.resource.title,
        review=review,
        review_age_days=7,
        reviews_link=reverse_fqdn('orb_user_reviews'),
    )
示例#11
0
def send_review_assignment_email(review):
    """
    Sends an email to the assigned reviewer for the given review.

    Args:
        review: a ContentReview

    Returns:
        result of `send_mail` - 1 or 0

    """
    return send_orb_email(
        template_html="orb/email/review_assignment.html",
        template_text="orb/email/review_assignment.txt",
        subject=_(u"Content Review for: ") + unicode(review.resource),
        recipients=[review.reviewer.email],
        reviewer_name=review.reviewer.get_full_name(),
        resource_title=review.resource.title,
        reviewer_role=review.role.get_name_display(),
        review=review,
        reviews_link=reverse_fqdn('orb_user_reviews'),
    )
示例#12
0
def send_review_assignment_email(review):
    """
    Sends an email to the assigned reviewer for the given review.

    Args:
        review: a ContentReview

    Returns:
        result of `send_mail` - 1 or 0

    """
    return send_orb_email(
        template_html="orb/email/review_assignment.html",
        template_text="orb/email/review_assignment.txt",
        subject=_(u"Content Review for: ") + unicode(review.resource),
        recipients=[review.reviewer.email],
        reviewer_name=review.reviewer.get_full_name(),
        resource_title=review.resource.title,
        reviewer_role=review.role.get_name_display(),
        review=review,
        reviews_link=reverse_fqdn('orb_user_reviews'),
    )