← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/bugtracker-sanitize-name-lowercase into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/bugtracker-sanitize-name-lowercase into lp:launchpad.

Commit message:
Lower-case display names from remote bugtrackers before running them through sanitize_name.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/bugtracker-sanitize-name-lowercase/+merge/332715

There are some comments whose author is just a string of all-caps initials.  Trying to import these OOPSes because sanitize_name results in the empty string, we then append "-redhat-bugs", and the result of that isn't a valid LP username.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/bugtracker-sanitize-name-lowercase into lp:launchpad.
=== modified file 'lib/lp/bugs/doc/bugtracker-person.txt'
--- lib/lp/bugs/doc/bugtracker-person.txt	2012-03-27 13:41:17 +0000
+++ lib/lp/bugs/doc/bugtracker-person.txt	2017-10-24 13:15:37 +0000
@@ -112,7 +112,7 @@
 addresses aren't provided.
 
     >>> noemail_person = bugtracker.ensurePersonForSelf(
-    ...     display_name='no-email-person',
+    ...     display_name='No-Email-Person',
     ...     email=None, rationale=PersonCreationRationale.BUGIMPORT,
     ...     creation_comment='whilst testing ensurePersonForSelf().')
 
@@ -120,11 +120,11 @@
     no-email-person-bugzilla-checkwatches
 
 A BugTrackerPerson record will have been created to map
-'no-email-person' on our example bugtracker to
+'No-Email-Person' on our example bugtracker to
 'no-email-person-bugzilla-checkwatches-1' in Launchpad.
 
     >>> bugtracker_person = bugtracker.getLinkedPersonByName(
-    ...     'no-email-person')
+    ...     'No-Email-Person')
 
     >>> bugtracker_person.person == noemail_person
     True

=== modified file 'lib/lp/bugs/model/bugtracker.py'
--- lib/lp/bugs/model/bugtracker.py	2016-07-25 11:42:50 +0000
+++ lib/lp/bugs/model/bugtracker.py	2017-10-24 13:15:37 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -635,7 +635,7 @@
 
         # Generate a valid Launchpad name for the Person.
         base_canonical_name = (
-            "%s-%s" % (sanitize_name(display_name), self.name))
+            "%s-%s" % (sanitize_name(display_name.lower()), self.name))
         canonical_name = base_canonical_name
 
         person_set = getUtility(IPersonSet)


Follow ups