launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03308
[Merge] lp:~adeuring/launchpad/bug-758902 into lp:launchpad
Abel Deuring has proposed merging lp:~adeuring/launchpad/bug-758902 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #758902 in Launchpad itself: "OOPS unlinking package association in translations details page"
https://bugs.launchpad.net/launchpad/+bug/758902
For more details, see:
https://code.launchpad.net/~adeuring/launchpad/bug-758902/+merge/57502
This branch fixes bug 758902: "OOPS unlinking package association in translations details page"
The problem is trivial: PackagingUtil.deletePackaging() raises an assertion error if the the given productseries and sourcepackage are not/no longer linked by a packaging record.
The fix is equally trivial: SourcePackageRemoveUpstreamView.unlink() should call deletePackaging() if the packaging record still exists.
test: ./bin/test registry -vvt sourcepackage-views.txt
no lint
--
https://code.launchpad.net/~adeuring/launchpad/bug-758902/+merge/57502
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~adeuring/launchpad/bug-758902 into lp:launchpad.
=== modified file 'lib/lp/registry/browser/sourcepackage.py'
--- lib/lp/registry/browser/sourcepackage.py 2011-04-13 05:38:13 +0000
+++ lib/lp/registry/browser/sourcepackage.py 2011-04-13 14:46:52 +0000
@@ -425,13 +425,17 @@
@action('Unlink')
def unlink(self, action, data):
old_series = self.context.productseries
- getUtility(IPackagingUtil).deletePackaging(
- self.context.productseries,
- self.context.sourcepackagename,
- self.context.distroseries)
- self.request.response.addInfoNotification(
- 'Removed upstream association between %s and %s.' % (
- old_series.title, self.context.distroseries.displayname))
+ if self.context.direct_packaging is not None:
+ getUtility(IPackagingUtil).deletePackaging(
+ self.context.productseries,
+ self.context.sourcepackagename,
+ self.context.distroseries)
+ self.request.response.addInfoNotification(
+ 'Removed upstream association between %s and %s.' % (
+ old_series.title, self.context.distroseries.displayname))
+ else:
+ self.request.response.addInfoNotification(
+ 'The packaging link has already been deleted.')
class SourcePackageView:
=== modified file 'lib/lp/registry/browser/tests/sourcepackage-views.txt'
--- lib/lp/registry/browser/tests/sourcepackage-views.txt 2011-04-11 16:00:53 +0000
+++ lib/lp/registry/browser/tests/sourcepackage-views.txt 2011-04-13 14:46:52 +0000
@@ -353,11 +353,11 @@
>>> print view.cancel_url
http://launchpad.dev/youbuntu/wonky/+source/stinkypackage
- >>> login_person(package.packaging.owner)
+ >>> user = package.packaging.owner
+ >>> login_person(user)
>>> form = {'field.actions.unlink': 'Unlink'}
>>> view = create_initialized_view(
- ... package, name='+remove-packaging', form=form,
- ... principal=package.packaging.owner)
+ ... package, name='+remove-packaging', form=form, principal=user)
>>> view.errors
[]
@@ -365,6 +365,19 @@
... print notification.message
Removed upstream association between Stinky stinkyseries series and Wonky.
+If somebody attempts to remove this packaging link a second time,
+they get a message telling them that the link has already been
+deleted.
+
+ >>> view = create_initialized_view(
+ ... package, name='+remove-packaging', form=form, principal=user)
+ >>> view.errors
+ []
+
+ >>> for notification in view.request.response.notifications:
+ ... print notification.message
+ The packaging link has already been deleted.
+
>>> view = create_initialized_view(package, name='+portlet-associations')
>>> print extract_text(find_tag_by_id(view.render(), 'no-upstreams'))
Launchpad doesn’t know which project ...