~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/model/person.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-07-30 09:17:36 UTC
  • mfrom: (13555.6.2 bug-761874)
  • Revision ID: launchpad@pqm.canonical.com-20110730091736-jjqwebomgxusdl3u
[r=wallyworld][bug=761874] Stop mailing ~registry on team deletes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3914
3914
            naked_from_team.retractTeamMembership(team, reviewer)
3915
3915
        IStore(from_team).flush()
3916
3916
 
3917
 
    def mergeAsync(self, from_person, to_person, reviewer=None):
 
3917
    def mergeAsync(self, from_person, to_person, reviewer=None, delete=False):
3918
3918
        """See `IPersonSet`."""
3919
3919
        return getUtility(IPersonMergeJobSource).create(
3920
 
            from_person=from_person, to_person=to_person, reviewer=reviewer)
 
3920
            from_person=from_person, to_person=to_person, reviewer=reviewer,
 
3921
            delete=delete)
 
3922
 
 
3923
    def delete(self, from_person, reviewer):
 
3924
        """See `IPersonSet`."""
 
3925
        # Deletes are implemented by merging into registry experts. Force
 
3926
        # the target to prevent any accidental misuse by calling code.
 
3927
        to_person = getUtility(ILaunchpadCelebrities).registry_experts
 
3928
        return self._merge(from_person, to_person, reviewer, True)
3921
3929
 
3922
3930
    def merge(self, from_person, to_person, reviewer=None):
3923
3931
        """See `IPersonSet`."""
 
3932
        return self._merge(from_person, to_person, reviewer)
 
3933
 
 
3934
    def _merge(self, from_person, to_person, reviewer, delete=False):
 
3935
        """Helper for merge and delete methods."""
3924
3936
        # since we are doing direct SQL manipulation, make sure all
3925
3937
        # changes have been flushed to the database
3926
3938
        store = Store.of(from_person)
4154
4166
                UPDATE OpenIdIdentifier SET account=%s WHERE account=%s
4155
4167
                """ % sqlvalues(to_person.accountID, from_person.accountID))
4156
4168
 
 
4169
        if delete:
 
4170
            # We don't notify anyone about deletes.
 
4171
            return
 
4172
 
4157
4173
        # Inform the user of the merge changes.
4158
4174
        if to_person.isTeam():
4159
4175
            mail_text = get_email_template(