← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/drop-emailaddress.account into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/drop-emailaddress.account into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/drop-emailaddress.account/+merge/88809

Remove the last users of EmailAddress.account so it can be dropped.
-- 
https://code.launchpad.net/~wgrant/launchpad/drop-emailaddress.account/+merge/88809
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/drop-emailaddress.account into lp:launchpad.
=== modified file 'lib/lp/app/validators/validation.py'
--- lib/lp/app/validators/validation.py	2012-01-01 02:58:52 +0000
+++ lib/lp/app/validators/validation.py	2012-01-17 04:53:26 +0000
@@ -92,23 +92,12 @@
 def _check_email_availability(email):
     email_address = getUtility(IEmailAddressSet).getByEmail(email)
     if email_address is not None:
-        # The email already exists; determine what has it.
-        if email_address.person is not None:
-            person = email_address.person
-            message = _('${email} is already registered in Launchpad and is '
-                        'associated with <a href="${url}">${person}</a>.',
-                        mapping={'email': escape(email),
-                                'url': canonical_url(person),
-                                'person': escape(person.displayname)})
-        elif email_address.account is not None:
-            account = email_address.account
-            message = _('${email} is already registered in Launchpad and is '
-                        'associated with the ${account} account.',
-                        mapping={'email': escape(email),
-                                'account': escape(account.displayname)})
-        else:
-            message = _('${email} is already registered in Launchpad.',
-                        mapping={'email': escape(email)})
+        person = email_address.person
+        message = _('${email} is already registered in Launchpad and is '
+                    'associated with <a href="${url}">${person}</a>.',
+                    mapping={'email': escape(email),
+                            'url': canonical_url(person),
+                            'person': escape(person.displayname)})
         raise LaunchpadValidationError(structured(message))
 
 

=== modified file 'lib/lp/registry/browser/peoplemerge.py'
--- lib/lp/registry/browser/peoplemerge.py	2012-01-01 02:58:52 +0000
+++ lib/lp/registry/browser/peoplemerge.py	2012-01-17 04:53:26 +0000
@@ -134,11 +134,10 @@
             # Transfer user email addresses. Team addresses will be deleted.
             for email in self.dupe_person_emails:
                 email = IMasterObject(email)
-                # EmailAddress.person and EmailAddress.account are readonly
-                # fields, so we need to remove the security proxy here.
+                # EmailAddress.person is a readonly field, so we need to
+                # remove the security proxy here.
                 naked_email = removeSecurityProxy(email)
                 naked_email.personID = self.target_person.id
-                naked_email.accountID = self.target_person.accountID
                 naked_email.status = EmailAddressStatus.NEW
         getUtility(IPersonSet).mergeAsync(
             self.dupe_person, self.target_person, reviewer=self.user,

=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py	2012-01-15 11:50:42 +0000
+++ lib/lp/registry/browser/person.py	2012-01-17 04:53:26 +0000
@@ -3942,7 +3942,7 @@
                     "detected it as being yours. If it was detected by our "
                     "system, it's probably shown on this page and is waiting "
                     "to be confirmed as yours." % newemail)
-            elif email.person is not None:
+            else:
                 owner = email.person
                 owner_name = urllib.quote(owner.name)
                 merge_url = (
@@ -3957,17 +3957,6 @@
                     canonical_url(owner),
                     owner.displayname,
                     merge_url))
-            elif email.account is not None:
-                account = email.account
-                self.addError(structured(
-                    "The email address '%s' is already registered to an "
-                    "account, %s.",
-                    newemail,
-                    account.displayname))
-            else:
-                self.addError(structured(
-                    "The email address '%s' is already registered.",
-                    newemail))
         return self.errors
 
     @action(_("Add"), name="add_email", validator=validate_action_add_email)

=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py	2012-01-12 08:13:59 +0000
+++ lib/lp/scripts/garbo.py	2012-01-17 04:53:26 +0000
@@ -312,12 +312,6 @@
         """
 
 
-class AccountOnlyEmailAddressPruner(BulkPruner):
-    """Remove EmailAddress records not linked to a Person."""
-    target_table_class = EmailAddress
-    ids_to_prune_query = "SELECT id FROM EmailAddress WHERE person IS NULL"
-
-
 class UnlinkedAccountPruner(BulkPruner):
     """Remove Account records not linked to a Person."""
     target_table_class = Account
@@ -329,11 +323,8 @@
     ids_to_prune_query = """
         SELECT Account.id
         FROM Account
-        LEFT OUTER JOIN EmailAddress ON Account.id = EmailAddress.account
         LEFT OUTER JOIN Person ON Account.id = Person.account
-        WHERE
-            EmailAddress.id IS NULL
-            AND Person.id IS NULL
+        WHERE Person.id IS NULL
         """
 
 
@@ -1306,7 +1297,6 @@
         SuggestiveTemplatesCacheUpdater,
         POTranslationPruner,
         UnusedPOTMsgSetPruner,
-        AccountOnlyEmailAddressPruner,
         UnlinkedAccountPruner,
         ]
     experimental_tunable_loops = [