Merge lp:~sinzui/launchpad/project-set-owner-0 into lp:launchpad
Status: | Merged |
---|---|
Merged at revision: | 11632 |
Proposed branch: | lp:~sinzui/launchpad/project-set-owner-0 |
Merge into: | lp:launchpad |
Diff against target: |
409 lines (+127/-141) 7 files modified
lib/lp/registry/browser/tests/product-edit-people-view.txt (+5/-51) lib/lp/registry/doc/product.txt (+2/-53) lib/lp/registry/model/product.py (+21/-22) lib/lp/registry/stories/webservice/xx-project-registry.txt (+0/-10) lib/lp/translations/configure.zcml (+5/-0) lib/lp/translations/subscribers.py (+44/-0) lib/lp/translations/tests/test_translationimportqueue.py (+50/-5) |
To merge this branch: | bzr merge lp:~sinzui/launchpad/project-set-owner-0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brad Crittenden (community) | code | Approve | |
Jeroen T. Vermeulen | Pending | ||
Review via email: mp+36055@code.launchpad.net |
Description of the change
This is my branch to remove the cascading reassignment when a project
owner is reassigned and avoid oopses with translation queue entries.
reviewer jtv
lp:~sinzui/launchpad/project-set-owner-0
Diff size: 430
Launchpad bug:
https:/
Test command: ./bin/test -vv \
-t product-
-t test_translatio
Pre-
Target release: 10.10
Remove the cascading reassignment when a project owner reassigned
-------
OOPS-1714L464 show that IntegrityError: duplicate key value violates unique
constraint "translationimp
when the user tried to set the project owner to the same team as the project
driver (elementaryart
The product-
translationimpo
discovered that reassigning a project owner causes many subordinate
object to also be reassigned. The rules for releases, series, and entries
are pointless, because Launchpad does not use the owner field for permissions.
The project owner or driver is always used. Launchpad does not need to do
this work.
Rules
-----
* Remove the reassignment rules from Product._setOwner()
* Add a subscriber that reassigns import entries only when there
is no conflict.
QA
--
We can verify this bug is fixed on edge by setting /nautilus-
to ~elementaryart. I will ask the project owner when we think the fix is
ready.
Lint
----
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
Test
----
* lib/lp/
* Remove the tests that verify reassignment...the view never did that.
* lib/lp/
* Removed the tests for reassignment because the rules were moved
out of Product.
* lib/lp/
* Added a test to verify when an entry's importer is reassigned, and
when it is not.
Implementation
--------------
* lib/lp/
* Replaced the mutator with a simple object.
* lib/lp/
* Updated the test to use the real object attr.
* lib/lp/
* Registered a subscriber to handle product changes.
* lib/lp/
* Added a subscriber function that updated the entry importer attr
if the product owner changes and there is no conflict.
Hi Curtis,
Interesting branch. So, all along, the effort of changing series and
releases was for nothing? I think we discussed it a *long* time ago
and decided it was unnecessary but harmless. Glad you simplified
things by getting rid of it.
I've got a couple of questions on the tests, shown in-line below.
> === added file 'lib/lp/ translations/ subscribers. py' translations/ subscribers. py 1970-01-01 00:00:00 +0000 translations/ subscribers. py 2010-09-24 14:17:10 +0000
> --- lib/lp/
> +++ lib/lp/
> +def product_ modified( product, event): before_ modification. owner ITranslationImp ortQueue) queue.getAllEnt ries(target= product) : entries. append( entry) entries. append( entry)
> + """Update translations objects when the product changes."""
> + old_owner = event.object_
> + if old_owner != product.owner:
> + import_queue = getUtility(
> + # The change in ownership may cause permission issues for
> + # entries in the translation import queue *if* the old owner has
> + # less permission now. This issue can be avoided by updating the
> + # entries's importer to the new owner. This can only be done if the
> + # new owner does not already have an entry in the queue.
> + # See bug 635438 for more details.
> + old_owner_entries = []
> + new_owner_entries = []
> + for entry in import_
> + if entry.importer == old_owner:
> + old_owner_
> + elif entry.importer == product.owner:
> + new_owner_
> + else:
> + # There is not permission issue.
Please reword this comment because I'm not sure what you're saying.
> + pass owner_entries) > 0 and len(new_ owner_entries) == 0:
> + if len(old_
> + # The new owner does not have any conflicting entries in the
> + # queue. Change the old owner's entries to the new owner to
> + # ensure there is not permissions issues during processing.
s/there is not permissions/there are no permission/ ???
> + for entry in old_owner_entries: roxy(entry) .importer = product.owner
> + removeSecurityP
> === modified file 'lib/lp/ translations/ tests/test_ translationimpo rtqueue. py' translations/ tests/test_ translationimpo rtqueue. py 2010-08-20 20:31:18 +0000 translations/ tests/test_ translationimpo rtqueue. py 2010-09-24 14:17:10 +0000 launchpad. interfaces. launchpad import ILaunchpadCeleb rities ssLayer onalLayer, ssLayer, worlddata. interfaces. language import ILanguageSet
> --- lib/lp/
> +++ lib/lp/
> @@ -1,7 +1,7 @@
> -# Copyright 2009 Canonical Ltd. This software is licensed under the
> +# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
> # GNU Affero General Public License version 3 (see the file LICENSE).
>
> -# pylint: disable-msg=C0102
> +from __future__ import with_statement
>
> __metaclass__ = type
>
> @@ -11,9 +11,15 @@
> from zope.component import getUtility
>
> from canonical.
> -from canonical.testing import LaunchpadZopele
> +from canonical.testing import (
> + LaunchpadFuncti
> + LaunchpadZopele
> + )
> from lp.services.
> -from lp.testing import TestCaseWithFactory
> +from lp.t...