Merge lp:~stevenk/launchpad/say-no-bpns-alsoaffects into lp:launchpad
Proposed by
Steve Kowalik
Status: | Merged |
---|---|
Approved by: | Steve Kowalik |
Approved revision: | no longer in the source branch. |
Merged at revision: | 13191 |
Proposed branch: | lp:~stevenk/launchpad/say-no-bpns-alsoaffects |
Merge into: | lp:launchpad |
Diff against target: |
156 lines (+88/-34) 4 files modified
lib/lp/bugs/browser/bugalsoaffects.py (+11/-10) lib/lp/bugs/browser/tests/test_bugalsoaffects.py (+76/-0) lib/lp/bugs/stories/bug-also-affects/10-bug-requestdistrofix.txt (+0/-20) lib/lp/registry/model/distribution.py (+1/-4) |
To merge this branch: | bzr merge lp:~stevenk/launchpad/say-no-bpns-alsoaffects |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | Approve | ||
Review via email: mp+63810@code.launchpad.net |
Commit message
[r=jtv][bug=307620] Stop inviting users to file a bug on Launchpad if the picker for a distro task fails to find any results, and include whether or not Launchpad can search on binary package names as well.
Description of the change
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.
To post a comment you must log in.
Hi Steve,
My apologies for the delay in reviewing this. You can land this as-is if you really want, but there are a few tweaks I'd like you to consider (if not for now then for the future) and a few things that I do think need fixing.
1 === modified file 'lib/lp/ bugs/browser/ bugalsoaffects. py' bugs/browser/ bugalsoaffects. py 2011-05-27 21:12:25 +0000 bugs/browser/ bugalsoaffects. py 2011-06-08 04:03:29 +0000 'sourcepackagen ame'].name) ILaunchpadCeleb rities) .launchpad) ame', displayname, has_published_ binaries: displayname) displayname, entered_package, ror('sourcepack agename' , error)
2 --- lib/lp/
3 +++ lib/lp/
4 @@ -418,16 +418,16 @@
5 self.widgets[
6 if sourcepackagename is None and entered_package:
7 # The entered package doesn't exist.
8 - filebug_url = "%s/+filebug" % canonical_url(
9 - getUtility(
10 - self.setFieldError(
11 - 'sourcepackagen
12 - structured(
13 - 'There is no package in %s named "%s". If it should'
14 - ' be here, <a href="%s">report this as a bug</a>.',
15 - distribution.
16 - entered_package,
17 - filebug_url))
18 + binary_tracking = ''
19 + if not distribution.
20 + binary_tracking = structured(
21 + ' Launchpad does not track binary package names '
22 + 'in %s.' % distribution.
23 + error = structured(
24 + 'There is no package in %s named "%s".%s',
25 + distribution.
26 + binary_tracking)
27 + self.setFieldEr
You're running binary_tracking through structured twice here, and maybe compensating for that by not escaping distribution. displayname. To be honest it's not clear to me how this will work exactly: will the distro name in binary_tracking end up being escaped exactly once? Even if this is correct, please make it clearly correct as well. Otherwise an injection vulnerability could sneak in during future maintenance.
Also, it's traditionally been considered clearer in Launchpad to write alternative initializations of a variable in if/else form, rather than initializing it for both cases once and then conditionally overriding it:
18 + binary_tracking = '' has_published_ binaries: displayname)
19 + if not distribution.
20 + binary_tracking = structured(
21 + ' Launchpad does not track binary package names '
22 + 'in %s.' % distribution.
…would be more obvious if written along the lines of…
if distribution. has_published_ binaries:
binary_ tracking = ""
binary_ tracking = "Whaaaa there's an error!"
else:
Or you could use +=, or even (if you really want to be fancy about the whitespace) gather components of your message up in a list that you then " ".join().
In good news, structured supports keyword args. So you could do something like:
error = structured(
distro= distribution. displayname, package= entered_ package)
'There is no package in %(distro)s named "%(package)s". ' + binary_tracking,
N...