Exemplo n.º 1
0
def get_cc_recipients():
  """Returns a set of emails in CC group."""
  recipients = set()
  for ident in auth.list_group(CC_GROUP).members:
    if ident.is_user:
      try:
        mail.CheckEmailValid(ident.name, 'to')
        recipients.add(ident.name)
      except mail.InvalidEmailError:
        logging.error('invalid cc recipient %s', ident.name)
  return recipients
Exemplo n.º 2
0
def get_cc_recipients():
    """Returns a set of emails in CC group."""
    identities = auth.list_group(CC_GROUP)
    recipients = set()
    for ident in identities:
        if ident.kind == auth.IDENTITY_USER:
            try:
                mail.CheckEmailValid(ident.name, 'to')
                recipients.add(ident.name)
            except mail.InvalidEmailError:
                logging.error('invalid cc recipient %s', ident.name)
    return recipients
Exemplo n.º 3
0
def get_recipients(commit):
    """Returns a list of recipients for |commit|.

  If committer and author have same email, returns only author.
  """
    for r in (commit.author, commit.committer):
        try:
            mail.CheckEmailValid(r.email, 'to')
        except mail.InvalidEmailError as ex:
            raise FailedToNotify(('Failed to notify %s, invalid email %s: %s' %
                                  (r.name, r.email, ex)))

    names = {
        commit.committer.email: commit.committer.name,
        commit.author.email: commit.author.name,
    }
    return [
        '%s <%s>' % (name or email, email) for email, name in names.items()
    ]