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

Proposed by Colin Watson
Status: Merged
Merged at revision: 18490
Proposed branch: lp:~cjwatson/launchpad/bugtracker-sanitize-name-lowercase
Merge into: lp:launchpad
Diff against target: 45 lines (+5/-5)
2 files modified
lib/lp/bugs/doc/bugtracker-person.txt (+3/-3)
lib/lp/bugs/model/bugtracker.py (+2/-2)
To merge this branch: bzr merge lp:~cjwatson/launchpad/bugtracker-sanitize-name-lowercase
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+332715@code.launchpad.net

Commit message

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

Description of the change

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.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/doc/bugtracker-person.txt'
2--- lib/lp/bugs/doc/bugtracker-person.txt 2012-03-27 13:41:17 +0000
3+++ lib/lp/bugs/doc/bugtracker-person.txt 2017-10-24 13:15:37 +0000
4@@ -112,7 +112,7 @@
5 addresses aren't provided.
6
7 >>> noemail_person = bugtracker.ensurePersonForSelf(
8- ... display_name='no-email-person',
9+ ... display_name='No-Email-Person',
10 ... email=None, rationale=PersonCreationRationale.BUGIMPORT,
11 ... creation_comment='whilst testing ensurePersonForSelf().')
12
13@@ -120,11 +120,11 @@
14 no-email-person-bugzilla-checkwatches
15
16 A BugTrackerPerson record will have been created to map
17-'no-email-person' on our example bugtracker to
18+'No-Email-Person' on our example bugtracker to
19 'no-email-person-bugzilla-checkwatches-1' in Launchpad.
20
21 >>> bugtracker_person = bugtracker.getLinkedPersonByName(
22- ... 'no-email-person')
23+ ... 'No-Email-Person')
24
25 >>> bugtracker_person.person == noemail_person
26 True
27
28=== modified file 'lib/lp/bugs/model/bugtracker.py'
29--- lib/lp/bugs/model/bugtracker.py 2016-07-25 11:42:50 +0000
30+++ lib/lp/bugs/model/bugtracker.py 2017-10-24 13:15:37 +0000
31@@ -1,4 +1,4 @@
32-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
33+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
34 # GNU Affero General Public License version 3 (see the file LICENSE).
35
36 __metaclass__ = type
37@@ -635,7 +635,7 @@
38
39 # Generate a valid Launchpad name for the Person.
40 base_canonical_name = (
41- "%s-%s" % (sanitize_name(display_name), self.name))
42+ "%s-%s" % (sanitize_name(display_name.lower()), self.name))
43 canonical_name = base_canonical_name
44
45 person_set = getUtility(IPersonSet)