Merge lp:~wallyworld/launchpad/recursive-branch-resolution-failure into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Michael Hudson-Doyle |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11613 |
Proposed branch: | lp:~wallyworld/launchpad/recursive-branch-resolution-failure |
Merge into: | lp:launchpad |
Diff against target: |
168 lines (+68/-15) 2 files modified
lib/canonical/launchpad/browser/launchpad.py (+21/-7) lib/canonical/launchpad/browser/tests/test_launchpad.py (+47/-8) |
To merge this branch: | bzr merge lp:~wallyworld/launchpad/recursive-branch-resolution-failure |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Hudson-Doyle | Approve | ||
Review via email: mp+36403@code.launchpad.net |
Commit message
When parsing short from branch urls of the for +branch/foo/bar, in the case of an error, handle the case where the referring url is None.
Description of the change
Bug 645544 describes a recursive failure when navigating to a url like +/branch/foo. This is a bug resulting from work done on lp:~wallyworld/lanchpad/tales-linkify-broken-links for bug 404131.
The problem is that when a url is entered directly, the http referer is None and the redirection logic tries to send the browser to an invalid url.
Proposed fix
Simple fix in the error handling logic to simply raise an exception if there is no referer in the http request header. This is how the system used to work before the fix for bug 404131 was done.
Implementation Details
The only code changes were to:
- lib/canonical/
- lib/canonical/
Tests
bin/test -vvm canonical.
New tests were written to test for the cases where the referring url is None:
- test_nonexisten
- test_private_
The TestBranchTraversal class (and friends) needed to be changed to pass a default referring url to the business logic being tested since previously the referring url was always None. The test cases never made the distinction between navigating from a valid url or hacking the url directly.
lint
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/canonical
lib/canonical
As I said on IRC I'd like you to change the name of the 'url' variable redirect_branch to http_referer or referer. Otherwise it's all fine.
Cheers!