datatracker/ietf/secr/utils/mail.py
Henrik Levkowetz 9067f88fa7 Merged in [9650] from rjsparks@nostrum.com:
Set the parent for newly created RGs. Be more robust if an RG has no parent. Test creation of an RG. Fixes #1718 and #1719.
 - Legacy-Id: 9661
Note: SVN reference [9650] has been migrated to Git commit b9bf7594001f0014ff4c2ac3688b431f1fcd39ec
2015-06-03 16:52:49 +00:00

35 lines
1.3 KiB
Python

def get_ad_email_list(group):
'''
This function takes a group and returns the Area Director email as a list.
NOTE: we still have custom logic here for IRTF groups, where the "Area Director"
is the chair of the parent group, 'irtf'.
'''
emails = []
if group.type.slug == 'wg':
emails.append('%s-ads@tools.ietf.org' % group.acronym)
elif group.type.slug == 'rg' and group.parent:
emails.append(group.parent.role_set.filter(name='chair')[0].email.address)
return emails
def get_cc_list(group, person=None):
'''
This function takes a Group and Person. It returns a list of emails for the ads and chairs of
the group and the person's email if it isn't already in the list.
Per Pete Resnick, at IETF 80 meeting, session request notifications
should go to chairs,ads lists not individuals.
'''
emails = []
emails.extend(get_ad_email_list(group))
emails.extend(get_chair_email_list(group))
if person and person.email_address() not in emails:
emails.append(person.email_address())
return emails
def get_chair_email_list(group):
'''
This function takes a group and returns chair email(s) as a list.
'''
return [ r.email.address for r in group.role_set.filter(name='chair') ]