← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/random-logintoken-cleanup into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/random-logintoken-cleanup into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/random-logintoken-cleanup/+merge/142827

While trying to determine if any code still creates NEW e-mail addresses, I made some random cleanups.
-- 
https://code.launchpad.net/~stevenk/launchpad/random-logintoken-cleanup/+merge/142827
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/random-logintoken-cleanup into lp:launchpad.
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py	2013-01-07 02:40:55 +0000
+++ lib/lp/registry/browser/person.py	2013-01-11 03:48:22 +0000
@@ -2574,9 +2574,7 @@
         self.info_message = structured('\n<br />\n'.join(comments))
 
     def _validateGPG(self, key):
-        logintokenset = getUtility(ILoginTokenSet)
         bag = getUtility(ILaunchBag)
-
         preferredemail = bag.user.preferredemail.email
         login = bag.login
 
@@ -2585,10 +2583,9 @@
         else:
             tokentype = LoginTokenType.VALIDATESIGNONLYGPG
 
-        token = logintokenset.new(self.context, login,
-                                  preferredemail,
-                                  tokentype,
-                                  fingerprint=key.fingerprint)
+        token = getUtility(ILoginTokenSet).new(
+            self.context, login, preferredemail, tokentype,
+            fingerprint=key.fingerprint)
 
         token.sendGPGValidationRequest(key)
 
@@ -2988,8 +2985,8 @@
         if IEmailAddress.providedBy(email):
             email = email.email
         token = getUtility(ILoginTokenSet).new(
-                    self.context, getUtility(ILaunchBag).login, email,
-                    LoginTokenType.VALIDATEEMAIL)
+            self.context, getUtility(ILaunchBag).login, email,
+            LoginTokenType.VALIDATEEMAIL)
         token.sendEmailValidationRequest()
         self.request.response.addInfoNotification(
             "An e-mail message was sent to '%s' with "
@@ -3073,9 +3070,7 @@
                     '<a href="%s">%s</a>. If you think that is a '
                     'duplicated account, you can <a href="%s">merge it'
                     "</a> into your account.",
-                    newemail,
-                    canonical_url(owner),
-                    owner.displayname,
+                    newemail, canonical_url(owner), owner.displayname,
                     merge_url))
         return self.errors
 
@@ -3083,10 +3078,9 @@
     def action_add_email(self, action, data):
         """Register a new email for the person in context."""
         newemail = data['newemail']
-        logintokenset = getUtility(ILoginTokenSet)
-        token = logintokenset.new(
-                    self.context, getUtility(ILaunchBag).login, newemail,
-                    LoginTokenType.VALIDATEEMAIL)
+        token = getUtility(ILoginTokenSet).new(
+            self.context, getUtility(ILaunchBag).login, newemail,
+            LoginTokenType.VALIDATEEMAIL)
         token.sendEmailValidationRequest()
 
         self.request.response.addInfoNotification(

=== modified file 'lib/lp/services/verification/browser/logintoken.py'
--- lib/lp/services/verification/browser/logintoken.py	2013-01-10 06:04:00 +0000
+++ lib/lp/services/verification/browser/logintoken.py	2013-01-11 03:48:22 +0000
@@ -487,8 +487,7 @@
         email = emailset.getByEmail(self.context.email)
         if email is None:
             email = emailset.new(
-                email=self.context.email,
-                person=self.context.requester)
+                email=self.context.email, person=self.context.requester)
         return email
 
     def markEmailAsValid(self, email):