← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~sinzui/launchpad/delete-team-1 into lp:launchpad/devel

 

Curtis Hovey has proposed merging lp:~sinzui/launchpad/delete-team-1 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #610850 delete team IntegrityError: emailaddress__person__key
  https://bugs.launchpad.net/bugs/610850


This is my branch to ensure team emails are deletes before the team is
deleted so that an oops is not raised.

    lp:~sinzui/launchpad/delete-team-1
    Diff size: 40
    Launchpad bug:
          https://bugs.launchpad.net/bugs/610850
    Test command: ./bin/test -vv -t peoplemerge-views
    Pre-implementation: no one.
    Target release: 10.09


ensure team emails are deletes before the team is deleted
----------------------------------------------------------

OOPS-1669EB4270 shows that the merge into ~registry failed.

The team did have an email address and I set the team to send to all
members
(implicitly deleting the email address). I then used the delete action
to
merge the team with ~registry

I expect the delete team rules to delete team email addresses as the
first
step of the merge. ie, calling team.setContactAddress(None).


Rules
-----

    * Add a rule to delete the team email addresses /before/ the team is
      deleted.


QA
--

    * On staging, locate a team that you are not a member of with an
email
      address. Choose to delete the team.
    * Verify the team is deleted
    * Look in the staging database and verify the team's email address
is
      not in the database.


Lint
----

Linting changed files:
  lib/lp/registry/browser/peoplemerge.py
  lib/lp/registry/browser/tests/peoplemerge-views.txt


Test
----

    * lib/lp/registry/browser/tests/peoplemerge-views.txt
      * Revised the delete team with email test to verify that email
addresses
        are deleted


Implementation
--------------

    * lib/lp/registry/browser/peoplemerge.py
      * Added a call to setContactAddress(None) to delete the team's
addresses
        before calling doMerge()
-- 
https://code.launchpad.net/~sinzui/launchpad/delete-team-1/+merge/32203
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/delete-team-1 into lp:launchpad/devel.
=== modified file 'lib/lp/registry/browser/peoplemerge.py'
--- lib/lp/registry/browser/peoplemerge.py	2010-07-15 08:38:19 +0000
+++ lib/lp/registry/browser/peoplemerge.py	2010-08-10 14:11:14 +0000
@@ -321,6 +321,9 @@
     @action('Delete', name='delete', condition=canDelete)
     def merge_action(self, action, data):
         base = super(DeleteTeamView, self)
+        # Delete is implemented as a merge process, but email addresses should
+        # be deleted because ~registry can never claim them.
+        self.context.setContactAddress(None)
         base.deactivate_members_and_merge_action.success(data)
 
 

=== modified file 'lib/lp/registry/browser/tests/peoplemerge-views.txt'
--- lib/lp/registry/browser/tests/peoplemerge-views.txt	2010-07-12 16:29:33 +0000
+++ lib/lp/registry/browser/tests/peoplemerge-views.txt	2010-08-10 14:11:14 +0000
@@ -251,9 +251,8 @@
     >>> print find_tag_by_id(content, 'field.actions.delete')
     None
 
-The registry experts can delete a team with a new email address (from
-an import), which will be invisible, since only preferred email addresses are
-shown for teams.
+The registry experts can delete a team with an email address. The email
+address is deleted instead of being transferred to the registry experts team.
 
     >>> from canonical.launchpad.interfaces.emailaddress import (
     ...     IEmailAddressSet, EmailAddressStatus)
@@ -275,6 +274,9 @@
     >>> for notification in view.request.response.notifications:
     ...     print notification.message
     Team deleted.
+    >>> emails = getUtility(IEmailAddressSet).getByPerson(registry_experts)
+    >>> emails.count()
+    0
 
 Private teams can be deleted by admins.