Merge lp:~edwin-grubbs/launchpad/bug-676966-disallow-merging-people-with-ppas into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Curtis Hovey |
Approved revision: | no longer in the source branch. |
Merged at revision: | 12123 |
Proposed branch: | lp:~edwin-grubbs/launchpad/bug-676966-disallow-merging-people-with-ppas |
Merge into: | lp:launchpad |
Diff against target: |
251 lines (+123/-12) 6 files modified
lib/lp/registry/browser/peoplemerge.py (+8/-0) lib/lp/registry/browser/person.py (+4/-8) lib/lp/registry/browser/tests/test_peoplemerge.py (+54/-3) lib/lp/registry/doc/person-merge.txt (+16/-0) lib/lp/registry/interfaces/person.py (+9/-0) lib/lp/registry/model/person.py (+32/-1) |
To merge this branch: | bzr merge lp:~edwin-grubbs/launchpad/bug-676966-disallow-merging-people-with-ppas |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Curtis Hovey (community) | code | Approve | |
j.c.sackett (community) | code* | Approve | |
Review via email: mp+43116@code.launchpad.net |
Commit message
[r=jcsackett,
Description of the change
Summary
-------
To prevent oopses in the PPA publisher, a form error message is
displayed when the user tries to merge a person or team with a PPA
containing published packages.
Implementation details
-------
Since the merge views are using the same check as renaming a person with
a PPA, I have moved that check into the model and updated the rename
person view. Person.merge() also checks that the merged person does not
have a PPA with published packages.
lib/
lib/
lib/
Added check to the AdminMergeBaseView so that the check applies to
+adminpeoplemerge and +adminteammerge.
lib/
lib/
lib/
Tests
-----
./bin/test -vv -t whatever
Demo and Q/A
------------
* Open http://
Lint
----
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
./lib/lp/
143: E301 expected 1 blank line, found 2
./lib/lp/
1: narrative uses a moin header.
22: narrative uses a moin header.
32: narrative uses a moin header.
61: narrative exceeds 78 characters.
85: narrative exceeds 78 characters.
105: narrative uses a moin header.
122: narrative uses a moin header.
339: narrative uses a moin header.
./lib/lp/
493: E302 expected 2 blank lines, found 1
./lib/lp/
1480: W291 trailing whitespace
1480: Line has trailing whitespace.
Hey Edwin--
I really like this branch. I just have some suggestions/ questions on comments below.
> === modified file 'lib/lp/ registry/ browser/ peoplemerge. py' registry/ browser/ peoplemerge. py 2010-12-03 16:33:03 +0000 registry/ browser/ peoplemerge. py 2010-12-08 18:32:00 +0000 _("You can't merge ${name} into itself.", dict(name= dupe_person. name))) has_ppa_ with_published_ packages: dict(name= dupe_person. name)))
> --- lib/lp/
> +++ lib/lp/
> @@ -132,6 +132,13 @@
> if dupe_person == target_person and dupe_person is not None:
> self.addError(
> mapping=
> + # We cannot merge the teams if there is a PPA with published
> + # packages on the duplicate person, unless that PPA is removed.
> + if dupe_person.
> + self.addError(_(
> + "${name} has a PPA with published packages; we "
> + "can't merge it.", mapping=
It might be good to direct someone to info on what they can do to get around this? In
other places where we throw an error in merging we indicate that a team needs to be removed or something; perhaps "the PPA must be deleted before we can merge ${name}, after the merge a new PPA can be recreated?
> === modified file 'lib/lp/ registry/ browser/ tests/test_ peoplemerge. py' registry/ browser/ tests/test_ peoplemerge. py 2010-12-03 16:33:03 +0000 registry/ browser/ tests/test_ peoplemerge. py 2010-12-08 18:32:00 +0000 l([], view.errors) l(self. target_ team, self.dupe_ team.merged) merge_team_ with_ppa_ containing_ published_ packages( self): ('admin' ) team.subscripti onpolicy = TeamSubscriptio nPolicy. MODERATED team.createPPA( ) makeSourcePacka gePublishingHis tory(archive= archive) ('registry_ experts' )
> --- lib/lp/
> +++ lib/lp/
> @@ -152,3 +155,51 @@
> view = self.getView()
> self.assertEqua
> self.assertEqua
> +
> + def test_cannot_
> + # The PPA must be removed before the team can be merged.
> + login_celebrity
> + self.dupe_
> + archive = self.dupe_
> + self.factory.
> + login_celebrity
> + view = self.getView()
> + self.assertEqual(
> + [u"dupe-team has a PPA with published packages; "
> + "we can't merge it."],
> + view.errors)
I'd change the comment to just "A team cannot be merged with published PPA" since the test doesn't demonstrate removing the PPA to make it work.
> === modified file 'lib/lp/ registry/ doc/person- merge.txt' registry/ doc/person- merge.txt 2010-12-01 23:39:05 +0000 registry/ doc/person- merge.txt 2010-12-08 18:32:00 +0000 deactivateAllMe mbers(comment, personset. getByName( 'name16' )) super_teams: retractTeamMemb ership( team, test_team. teamowner) merge(test_ team, landscape) developers no new super teams, has
> --- lib/lp/
> +++ lib/lp/
> @@ -425,6 +425,8 @@
> >>> test_team.
> >>> for team in test_team.
> ... test_team.
> +
> +
> >>> personset.
>
> # The resulting Landscape-
Thanks for the cleanup.
> @@ -438,3 +440,18 @@ t(landscape) .getAll( )) makePerson( )
> []
> >>> list(IPollSubse
> []
> +
> +A person with a PPA can't be merged until the PPA is deleted.
> +
> + >>> person_with_ppa = factory.
> + >>> ot...