##// END OF EJS Templates
notifications: use a set initially instead of list later converted to set.
marcink -
r3273:97a79574 default
parent child Browse files
Show More
@@ -95,15 +95,14 b' class NotificationModel(BaseModel):'
95 log.debug('sending notifications %s to admins: %s',
95 log.debug('sending notifications %s to admins: %s',
96 notification_type, recipients_objs)
96 notification_type, recipients_objs)
97 else:
97 else:
98 recipients_objs = []
98 recipients_objs = set()
99 for u in recipients:
99 for u in recipients:
100 obj = self._get_user(u)
100 obj = self._get_user(u)
101 if obj:
101 if obj:
102 recipients_objs.append(obj)
102 recipients_objs.add(obj)
103 else: # we didn't find this user, log the error and carry on
103 else: # we didn't find this user, log the error and carry on
104 log.error('cannot notify unknown user %r', u)
104 log.error('cannot notify unknown user %r', u)
105
105
106 recipients_objs = set(recipients_objs)
107 if not recipients_objs:
106 if not recipients_objs:
108 raise Exception('no valid recipients specified')
107 raise Exception('no valid recipients specified')
109
108
@@ -122,7 +121,7 b' class NotificationModel(BaseModel):'
122 return notification
121 return notification
123
122
124 # don't send email to person who created this comment
123 # don't send email to person who created this comment
125 rec_objs = set(recipients_objs).difference(set([created_by_obj]))
124 rec_objs = set(recipients_objs).difference({created_by_obj})
126
125
127 # now notify all recipients in question
126 # now notify all recipients in question
128
127
General Comments 0
You need to be logged in to leave comments. Login now