Merge lp:~stevenk/launchpad/better-error-+archivesubscriptions into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Steve Kowalik
Approved revision: no longer in the source branch.
Merged at revision: 14716
Proposed branch: lp:~stevenk/launchpad/better-error-+archivesubscriptions
Merge into: lp:launchpad
Diff against target: 34 lines (+11/-1)
2 files modified
lib/lp/registry/browser/person.py (+3/-1)
lib/lp/soyuz/stories/ppa/xx-private-ppa-subscriptions.txt (+8/-0)
To merge this branch: bzr merge lp:~stevenk/launchpad/better-error-+archivesubscriptions
Reviewer Review Type Date Requested Status
Ian Booth (community) Approve
Review via email: mp+89798@code.launchpad.net

Commit message

[r=wallyworld][bug=891607] Deal with the case where the archive id is not a number for Person:+archivesubscriptions.

Description of the change

Deal with the case where the archive id is not a number, and return not found.

To post a comment you must log in.
Revision history for this message
Ian Booth (wallyworld) wrote :

Looks good. Sometimes where are tests which check the http error code (eg 404 in this case) for given scenarios. Are there any of those which need updating?

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/person.py'
2--- lib/lp/registry/browser/person.py 2012-01-17 23:55:44 +0000
3+++ lib/lp/registry/browser/person.py 2012-01-23 22:40:29 +0000
4@@ -1,4 +1,4 @@
5-# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
6+# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
7 # GNU Affero General Public License version 3 (see the file LICENSE).
8
9 # pylint: disable-msg=E0211,E0213,C0322
10@@ -497,6 +497,8 @@
11 # In which case we assume it is the archive_id (for the
12 # moment, archive name will be an option soon).
13 archive_id = self.request.stepstogo.consume()
14+ if not archive_id.isdigit():
15+ return None
16 return traverse_archive_subscription_for_subscriber(
17 self.context, archive_id)
18 else:
19
20=== modified file 'lib/lp/soyuz/stories/ppa/xx-private-ppa-subscriptions.txt'
21--- lib/lp/soyuz/stories/ppa/xx-private-ppa-subscriptions.txt 2012-01-15 13:32:27 +0000
22+++ lib/lp/soyuz/stories/ppa/xx-private-ppa-subscriptions.txt 2012-01-23 22:40:29 +0000
23@@ -221,3 +221,11 @@
24 PPA named p3a for Mark Shuttleworth (ppa:mark/p3a) Mark Shuttleworth View
25 PPA named p3a for Celso Providelo (ppa:cprov/p3a) Celso Providelo View
26
27+== Attempting to browse directly to a subscription ==
28+
29+ >>> joe_browser.open(
30+ ... "http://launchpad.dev/~joesmith/+archivesubscriptions/foo")
31+ Traceback (most recent call last):
32+ ...
33+ NotFound...
34+