|
3 | 3 |
|
4 | 4 |
|
5 | 5 | import datetime |
| 6 | +import inflect |
6 | 7 | from collections import defaultdict, OrderedDict |
7 | 8 |
|
8 | 9 | from django.conf import settings |
@@ -105,18 +106,29 @@ def get_lock_message(meeting=None): |
105 | 106 | meeting = get_meeting(days=14) |
106 | 107 | return meeting.session_request_lock_message |
107 | 108 |
|
108 | | -def get_requester_text(person,group): |
109 | | - ''' |
110 | | - This function takes a Person object and a Group object and returns the text to use in the |
111 | | - session request notification email, ie. Joe Smith, a Chair of the ancp working group |
112 | | - ''' |
113 | | - roles = group.role_set.filter(name__in=('chair','secr'),person=person) |
| 109 | + |
| 110 | +def get_requester_text(person, group): |
| 111 | + """ |
| 112 | + This function takes a Person object and a Group object and returns the text to use |
| 113 | + in the session request notification email, ie. Joe Smith, a Chair of the ancp |
| 114 | + working group |
| 115 | + """ |
| 116 | + roles = group.role_set.filter(name__in=("chair", "secr", "ad"), person=person) |
114 | 117 | if roles: |
115 | | - return '%s, a %s of the %s working group' % (person.ascii, roles[0].name, group.acronym) |
116 | | - if group.parent and group.parent.role_set.filter(name='ad',person=person): |
117 | | - return '%s, a %s Area Director' % (person.ascii, group.parent.acronym.upper()) |
118 | | - if person.role_set.filter(name='secr',group__acronym='secretariat'): |
119 | | - return '%s, on behalf of the %s working group' % (person.ascii, group.acronym) |
| 118 | + rolename = str(roles[0].name) |
| 119 | + return "%s, %s of the %s %s" % ( |
| 120 | + person.name, |
| 121 | + inflect.engine().a(rolename), |
| 122 | + group.acronym.upper(), |
| 123 | + group.type.verbose_name, |
| 124 | + ) |
| 125 | + if person.role_set.filter(name="secr", group__acronym="secretariat"): |
| 126 | + return "%s, on behalf of the %s %s" % ( |
| 127 | + person.name, |
| 128 | + group.acronym.upper(), |
| 129 | + group.type.verbose_name, |
| 130 | + ) |
| 131 | + |
120 | 132 |
|
121 | 133 | def save_conflicts(group, meeting, conflicts, name): |
122 | 134 | ''' |
|
0 commit comments