Merge lp:~julian-edwards/launchpad/ppa-search-oops-bug-446157 into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | not available | ||||
Proposed branch: | lp:~julian-edwards/launchpad/ppa-search-oops-bug-446157 | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
42 lines 2 files modified
lib/lp/registry/browser/distribution.py (+7/-0) lib/lp/soyuz/stories/ppa/xx-ubuntu-ppas.txt (+14/-0) |
||||
To merge this branch: | bzr merge lp:~julian-edwards/launchpad/ppa-search-oops-bug-446157 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Nelson (community) | code | 2009-10-14 | Approve on 2009-10-15 |
Review via email:
|
Julian Edwards (julian-edwards) wrote : | # |
Michael Nelson (michael.nelson) wrote : | # |
Thanks Julian. Just a suggestion for changing the comment below.
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -646,6 +646,15 @@
>
> def initialize(self):
> self.name_filter = self.request.
> + if isinstance(
> + # This happens if someone hand-hacks the URL so that it has
> + # more than one name_filter field.
> + #
Is that normal? I've normally just left a blank line there. I'm just
interested to know.
> + # XXX 2009-10-14 Julian bug=451424
> + # There really should be a way for the form to reject
> + # unexpected input like this before it hits the code here.
> + # See bug 451424.
As per our conversation, I think the issue here is more that we are not
using an LPFormView. We could inherit from LPFormView, have an interface
for the search form defined, use a safe_action and the data would be
validated automatically right? Up to you whether you want to go ahead
and actually do that, or simply update the above comment.
> + self.name_filter = " ".join(
Great - at first I wondered why you didn't just grab name_filter[0]
(or [-1]), but the doctest has a good justification for joining the
terms.
> self.show_inactive = self.request.
>
> @property
>
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -246,6 +246,20 @@
> 1
>
>
> +=== Hand-hacked search URLs ==
> +
> +If the search term is specified more than once by someone hand-hacking the
> +URL, the page copes gracefully with this by searching for all the terms
> +specified.
> +
> + >>> anon_browser.open(
> + ... "http://
> + ... "?name_
> + >>> [row] = find_tags_
> + >>> print extract_text(row)
> + PPA for Celso Providelo...
> +
> +
> == Owner's PPA pages ==
>
> Let's start by adding an extra package to Celso's archive:
--
Michael
= Summary =
Fix an oops when someone hand-hacks URLs searching PPAs.
== Proposed fix ==
We need to cope with a list value when expecting a string in the form data.
This is a trivial change in the view code, but I also filed a Foundations bugs
since we should be able to do this generically in the form setup.
== Pre-implementation notes ==
None, I suck.
== Tests ==
bin/test -cvvt xx-ubuntu-ppas
== Demo and Q/A == /launchpad. dev/ubuntu/ +ppas?name_ filter= packages& name_filter= humanity
https:/
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: soyuz/stories/ ppa/xx- ubuntu- ppas.txt registry/ browser/ distribution. py
lib/lp/
lib/lp/