comparison roundup/roundupdb.py @ 1622:b3abda04a690

handle missing addresses on users [SF#724537]
author Richard Jones <richard@users.sourceforge.net>
date Sun, 27 Apr 2003 02:29:08 +0000
parents e109d59f232d
children c8614db86be2 ffba0a574b4e
comparison
equal deleted inserted replaced
1620:fc9dafcb62e0 1622:b3abda04a690
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 # $Id: roundupdb.py,v 1.85 2003-04-24 07:19:58 richard Exp $ 18 # $Id: roundupdb.py,v 1.86 2003-04-27 02:24:37 richard Exp $
19 19
20 __doc__ = """ 20 __doc__ = """
21 Extending hyperdb with types specific to issue-tracking. 21 Extending hyperdb with types specific to issue-tracking.
22 """ 22 """
23 23
131 131
132 # possibly send the message to the author, as long as they aren't 132 # possibly send the message to the author, as long as they aren't
133 # anonymous 133 # anonymous
134 if (users.get(authid, 'username') != 'anonymous' and 134 if (users.get(authid, 'username') != 'anonymous' and
135 not r.has_key(authid)): 135 not r.has_key(authid)):
136 if self.db.config.MESSAGES_TO_AUTHOR == 'yes': 136 if (self.db.config.MESSAGES_TO_AUTHOR == 'yes' or
137 # always CC the author of the message 137 (self.db.config.MESSAGES_TO_AUTHOR == 'new' and not oldvalues)):
138 sendto.append(authid) 138 # make sure they have an address
139 recipients.append(authid) 139 add = users.get(authid, 'address')
140 elif self.db.config.MESSAGES_TO_AUTHOR == 'new' and not oldvalues: 140 if add:
141 # only CC the author if the issue is new 141 # send it to them
142 sendto.append(authid) 142 sendto.append(add)
143 recipients.append(authid) 143 recipients.append(authid)
144
144 r[authid] = 1 145 r[authid] = 1
145 146
146 # now deal with cc people. 147 # now deal with cc people.
147 for cc_userid in cc : 148 for cc_userid in cc :
148 if r.has_key(cc_userid): 149 if r.has_key(cc_userid):
149 continue 150 continue
150 # send it to them 151 # make sure they have an address
151 sendto.append(cc_userid) 152 add = users.get(cc_userid, 'address')
152 recipients.append(cc_userid) 153 if add:
154 # send it to them
155 sendto.append(add)
156 recipients.append(cc_userid)
153 157
154 # now figure the nosy people who weren't recipients 158 # now figure the nosy people who weren't recipients
155 nosy = self.get(nodeid, whichnosy) 159 nosy = self.get(nodeid, whichnosy)
156 for nosyid in nosy: 160 for nosyid in nosy:
157 # Don't send nosy mail to the anonymous user (that user 161 # Don't send nosy mail to the anonymous user (that user
159 # do...) 163 # do...)
160 if users.get(nosyid, 'username') == 'anonymous': 164 if users.get(nosyid, 'username') == 'anonymous':
161 continue 165 continue
162 # make sure they haven't seen the message already 166 # make sure they haven't seen the message already
163 if not r.has_key(nosyid): 167 if not r.has_key(nosyid):
164 # send it to them 168 # make sure they have an address
165 sendto.append(nosyid) 169 add = users.get(nosyid, 'address')
166 recipients.append(nosyid) 170 if add:
171 # send it to them
172 sendto.append(add)
173 recipients.append(nosyid)
167 174
168 # generate a change note 175 # generate a change note
169 if oldvalues: 176 if oldvalues:
170 note = self.generateChangeNote(nodeid, oldvalues) 177 note = self.generateChangeNote(nodeid, oldvalues)
171 else: 178 else:
172 note = self.generateCreateNote(nodeid) 179 note = self.generateCreateNote(nodeid)
173 180
174 # we have new recipients 181 # we have new recipients
175 if sendto: 182 if sendto:
176 # map userids to addresses
177 sendto = [users.get(i, 'address') for i in sendto]
178
179 # update the message's recipients list 183 # update the message's recipients list
180 messages.set(msgid, recipients=recipients) 184 messages.set(msgid, recipients=recipients)
181 185
182 # send the message 186 # send the message
183 self.send_message(nodeid, msgid, note, sendto, from_address) 187 self.send_message(nodeid, msgid, note, sendto, from_address)

Roundup Issue Tracker: http://roundup-tracker.org/