Merge lp:~edwin-grubbs/launchpad/bug-676966-disallow-merging-people-with-ppas into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Curtis Hovey on 2010-12-17 |
| 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 | 2010-12-15 | Approve on 2010-12-17 |
| j.c.sackett (community) | code* | 2010-12-08 | Approve on 2010-12-15 |
|
Review via email:
|
|||
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.
| Edwin Grubbs (edwin-grubbs) wrote : | # |
Hi JC,
Thanks for the review. Here are the changes you asked for.
> Hey Edwin--
>
> I really like this branch. I just have some suggestions/
> below.
>
> > === modified file 'lib/lp/
> > --- 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?
I did something similar but a little bit shorter.
> > === modified file 'lib/lp/
> > --- lib/lp/
> +0000
> > +++ lib/lp/
> +0000
> > @@ -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_
> TeamSubscriptio
> > + 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.
Done.
> > === modified file 'lib/lp/
> > --- lib/lp/
> > +++ lib/lp/
> > @@ -425,6 +425,8 @@
> > >>> test_team.
> personset.
> > >>> for team in test_team.
> > ... test_team.
> > +
> > +
> > >>> personset.
> >
> > # The resulting Landscape-
| Curtis Hovey (sinzui) wrote : | # |
As we discussed on IRC "PPA that must be removed" should be "PPA that must be deleted" since that is the link the user must use.
has_ppa_
| Edwin Grubbs (edwin-grubbs) wrote : | # |
> As we discussed on IRC "PPA that must be removed" should be "PPA that must be
> deleted" since that is the link the user must use.
>
> has_ppa_
> without packages. I think these ppas will show up in searches. Can you talk to
> someone on the soyuz team
Hi Curtis,
Thanks for the review.
I have changed the condition to not allow merges on a person or team with a PPA in the ACTIVE or DELETING status whether or not it has published packages, so that links to merged persons don't show up in https:/
Incremental Diff:
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -134,11 +134,12 @@
# 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.
+ if dupe_person.
- "${name} has a PPA that must be removed before it "
- "can be merged.", mapping=
-
+ "${name} has a PPA that must be deleted before it "
+ "can be merged. It may take ten minutes to remove the "
+ "deleted PPA's files.",
+ mapping=
def render(self):
# Subclasses may define other actions that they will render manually
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -156,17 +156,17 @@
- def test_cannot_
- # A team with a published PPA cannot be merged.
+ def test_cannot_
+ # A team with a PPA cannot be merged.
archive = self.dupe_
- self.factory.
view = self.getView()
- [u'dupe-team has a PPA that must be removed before '
- 'it can be merged.'],
+ [u"dupe-team has a PPA that must be deleted before it can be "
+ "merged. It may take ten minutes to remove the deleted PPA's "
+ "files."],
def test_registry_
@@ -205,13 +205,13 @@
return create_
- def test_cannot_
- # The PPA must be r...
| Julian Edwards (julian-edwards) wrote : | # |
I think that the restriction on merging people with PPAs with or without publications is wrong. I originally suggested that we allow the merge to take place even though there's a PPA as long as it has no packages (i.e. it's a brand new one). Deleting these types of PPAs has zero affect other than to change its status; there's nothing to actually delete on disk.
The +archivesubscri
Also, has_existing_ppa and has_ppa_
should not be properties on IPerson, they should be on IArchiveSet so
that Soyuz-specific queries are kept in the lp.soyuz domain.
The Bugs team made this mistake with one of their bits of code that knows too
much about Soyuz publishing tables and caused circular imports when running
bin/test. It also makes future changes to soyuz code harder because the coder will not expect this sort of code to be outside the soyuz domain.
I recommend that this be fixed ASAP as tech debt. I filed bug 693357 about this.

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...