~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to scripts/mlist-sync.py

  • Committer: Curtis Hovey
  • Date: 2011-04-05 18:45:49 UTC
  • mto: This revision was merged to the branch mainline in revision 12788.
  • Revision ID: curtis.hovey@canonical.com-20110405184549-eazuwms9fkhxc8mm
Added test to verify the teams second email address is not updated by mlist-sync.
Fixed defect in code where a team's contact address is set to a purged list address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
167
167
            mlist_addresses = email_address_set.getByPerson(team)
168
168
            if mlist_addresses.count() == 0:
169
169
                self.logger.error('No LP email address for: %s', list_name)
170
 
            elif mlist_addresses.count() > 1:
171
 
                # This team has both a mailing list and a contact address.  We
172
 
                # only want to change the former, but we need some heuristics
173
 
                # to figure out which is which.
 
170
            else:
 
171
                # Teams can have both a mailing list and a contact address.
174
172
                old_address = '%s@%s' % (list_name, self.options.hostname)
175
173
                for email_address in mlist_addresses:
176
174
                    if email_address.email == old_address:
181
179
                else:
182
180
                    self.logger.error('No change to LP email address for: %s',
183
181
                                      list_name)
184
 
            else:
185
 
                email_address = removeSecurityProxy(mlist_addresses[0])
186
 
                old_address = email_address.email
187
 
                email_address.email = lp_mailing_list.address
188
 
                self.logger.info('%s -> %s',
189
 
                                 old_address, lp_mailing_list.address)
190
182
 
191
183
    def deleteMailmanList(self, list_name):
192
184
        """Delete all Mailman data structures for `list_name`."""