launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03866
[Merge] lp:~stevenk/launchpad/say-no-bpns-alsoaffects into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/say-no-bpns-alsoaffects into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #307620 in Launchpad itself: "Confusing message "There is a no package named 'xserver-xorg' in Debian" when filing a bug"
https://bugs.launchpad.net/launchpad/+bug/307620
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/say-no-bpns-alsoaffects/+merge/63810
Stop inviting users to file a bug on Launchpad if the picker for a distro task fails to find any results. Include text that suggest that Launchpad does not track binary package names for the distribution.
Drive-by a fix to IDistribution.has_published_binaries to make use of .is_empty().
--
https://code.launchpad.net/~stevenk/launchpad/say-no-bpns-alsoaffects/+merge/63810
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/say-no-bpns-alsoaffects into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugalsoaffects.py'
--- lib/lp/bugs/browser/bugalsoaffects.py 2011-05-27 21:12:25 +0000
+++ lib/lp/bugs/browser/bugalsoaffects.py 2011-06-08 04:03:29 +0000
@@ -418,16 +418,16 @@
self.widgets['sourcepackagename'].name)
if sourcepackagename is None and entered_package:
# The entered package doesn't exist.
- filebug_url = "%s/+filebug" % canonical_url(
- getUtility(ILaunchpadCelebrities).launchpad)
- self.setFieldError(
- 'sourcepackagename',
- structured(
- 'There is no package in %s named "%s". If it should'
- ' be here, <a href="%s">report this as a bug</a>.',
- distribution.displayname,
- entered_package,
- filebug_url))
+ binary_tracking = ''
+ if not distribution.has_published_binaries:
+ binary_tracking = structured(
+ ' Launchpad does not track binary package names '
+ 'in %s.' % distribution.displayname)
+ error = structured(
+ 'There is no package in %s named "%s".%s',
+ distribution.displayname, entered_package,
+ binary_tracking)
+ self.setFieldError('sourcepackagename', error)
else:
try:
validate_new_distrotask(
=== added file 'lib/lp/bugs/browser/tests/test_bugalsoaffects.py'
--- lib/lp/bugs/browser/tests/test_bugalsoaffects.py 1970-01-01 00:00:00 +0000
+++ lib/lp/bugs/browser/tests/test_bugalsoaffects.py 2011-06-08 04:03:29 +0000
@@ -0,0 +1,76 @@
+# Copyright 2011 Canonical Ltd. This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+__metaclass__ = type
+
+from zope.component import getUtility
+
+from canonical.launchpad.testing.pages import get_feedback_messages
+from canonical.launchpad.webapp import canonical_url
+from canonical.testing.layers import DatabaseFunctionalLayer
+from lp.registry.interfaces.person import IPersonSet
+from lp.soyuz.enums import PackagePublishingStatus
+from lp.testing import (
+ person_logged_in,
+ TestCaseWithFactory,
+ )
+from lp.testing.sampledata import ADMIN_EMAIL
+
+
+class TestBugAlsoAffectsDistribution(TestCaseWithFactory):
+
+ layer = DatabaseFunctionalLayer
+
+ def setUp(self):
+ super(TestBugAlsoAffectsDistribution, self).setUp()
+ self.admin = getUtility(IPersonSet).getByEmail(ADMIN_EMAIL)
+ self.distribution = self.factory.makeDistribution()
+ with person_logged_in(self.admin):
+ self.distribution.official_malone = True
+
+ def test_bug_alsoaffects_spn_exists(self):
+ bug = self.factory.makeBug()
+ spn = self.factory.makeSourcePackageName()
+ browser = self.getUserBrowser()
+ browser.open(canonical_url(bug))
+ browser.getLink(url='+distrotask').click()
+ browser.getControl('Distribution').value = [self.distribution.name]
+ browser.getControl('Source Package Name').value = spn.name
+ browser.getControl('Continue').click()
+ self.assertEqual([], get_feedback_messages(browser.contents))
+
+ def test_bug_alsoaffects_spn_not_exists_with_published_binaries(self):
+ bug = self.factory.makeBug()
+ distroseries = self.factory.makeDistroSeries(
+ distribution=self.distribution)
+ das = self.factory.makeDistroArchSeries(distroseries=distroseries)
+ bpph = self.factory.makeBinaryPackagePublishingHistory(
+ distroarchseries=das, status=PackagePublishingStatus.PUBLISHED)
+ self.assertTrue(self.distribution.has_published_binaries)
+ browser = self.getUserBrowser()
+ browser.open(canonical_url(bug))
+ browser.getLink(url='+distrotask').click()
+ browser.getControl('Distribution').value = [self.distribution.name]
+ browser.getControl('Source Package Name').value = 'does-not-exist'
+ browser.getControl('Continue').click()
+ expected = [
+ u'There is 1 error.',
+ u'There is no package in %s named "does-not-exist".' % (
+ self.distribution.displayname)]
+ self.assertEqual(expected, get_feedback_messages(browser.contents))
+
+ def test_bug_alsoaffects_spn_not_exists_with_no_binaries(self):
+ bug = self.factory.makeBug()
+ browser = self.getUserBrowser()
+ browser.open(canonical_url(bug))
+ browser.getLink(url='+distrotask').click()
+ browser.getControl('Distribution').value = [self.distribution.name]
+ browser.getControl('Source Package Name').value = 'does-not-exist'
+ browser.getControl('Continue').click()
+ expected = [
+ u'There is 1 error.',
+ u'There is no package in %s named "does-not-exist". Launchpad '
+ 'does not track binary package names in %s.' % (
+ self.distribution.displayname,
+ self.distribution.displayname)]
+ self.assertEqual(expected, get_feedback_messages(browser.contents))
=== modified file 'lib/lp/bugs/stories/bug-also-affects/10-bug-requestdistrofix.txt'
--- lib/lp/bugs/stories/bug-also-affects/10-bug-requestdistrofix.txt 2009-09-18 15:24:30 +0000
+++ lib/lp/bugs/stories/bug-also-affects/10-bug-requestdistrofix.txt 2011-06-08 04:03:29 +0000
@@ -177,23 +177,3 @@
<...
...>pmount (Debian)</a>...
...
-
-If we enter a source package which doesn't exist, we get an error
-message saying so.
-
- >>> browser.getLink(url='+distrotask').click()
- >>> browser.getControl('Distribution').value = ['ubuntu']
- >>> browser.getControl('Source Package Name').value = 'no-such-package'
- >>> browser.getControl('Continue').click()
- >>> browser.url
- 'http://bugs.launchpad.dev/debian/+source/pmount/+bug/1/+distrotask'
- >>> print get_feedback_messages(browser.contents)
- [u'There is 1 error.',
- u'There is no package in Ubuntu named "no-such-package". If it should
- be here, report this as a bug.']
-
-The link in the error page links to the Launchpad filebug page.
-
- >>> browser.getLink('report this as a bug').click()
- >>> print browser.title
- Report a bug about Launchpad...
=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py 2011-06-07 03:30:25 +0000
+++ lib/lp/registry/model/distribution.py 2011-06-08 04:03:29 +0000
@@ -1835,10 +1835,7 @@
BinaryPackagePublishingHistory.status ==
PackagePublishingStatus.PUBLISHED).config(limit=1)
- # XXX 2009-02-19 Julian
- # Storm is not very useful for bool checking on the results,
- # see: https://bugs.launchpad.net/soyuz/+bug/246200
- return results.any() != None
+ return not results.is_empty()
def sharesTranslationsWithOtherSide(self, person, language,
sourcepackage=None,