Merge lp:~stevenk/launchpad/loggerhead-reject-no-sreg into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Steve Kowalik
Approved revision: no longer in the source branch.
Merged at revision: 16459
Proposed branch: lp:~stevenk/launchpad/loggerhead-reject-no-sreg
Merge into: lp:launchpad
Diff against target: 25 lines (+9/-2)
1 file modified
lib/launchpad_loggerhead/app.py (+9/-2)
To merge this branch: bzr merge lp:~stevenk/launchpad/loggerhead-reject-no-sreg
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+145760@code.launchpad.net

Commit message

If the sreg_info is None in the Loggerhead glue, log and raise a 401, rather than OOPSing.

Description of the change

If the sreg_info is None, log and raise a 401, rather than OOPSing.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/launchpad_loggerhead/app.py'
--- lib/launchpad_loggerhead/app.py 2012-08-15 20:57:12 +0000
+++ lib/launchpad_loggerhead/app.py 2013-01-31 01:31:22 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009-2011 Canonical Ltd. This software is licensed under the1# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4import logging4import logging
@@ -138,7 +138,14 @@
138 if response.status == SUCCESS:138 if response.status == SUCCESS:
139 self.log.error('open id response: SUCCESS')139 self.log.error('open id response: SUCCESS')
140 sreg_info = SRegResponse.fromSuccessResponse(response)140 sreg_info = SRegResponse.fromSuccessResponse(response)
141 print sreg_info141 if not sreg_info:
142 self.log.error('sreg_info is None.')
143 exc = HTTPUnauthorized()
144 exc.explanation = (
145 "You don't have a Launchpad account. Check that you're "
146 "logged in as the right user, or log into Launchpad and try "
147 "again.")
148 raise exc
142 environ[self.session_var]['user'] = sreg_info['nickname']149 environ[self.session_var]['user'] = sreg_info['nickname']
143 raise HTTPMovedPermanently(query['back_to'])150 raise HTTPMovedPermanently(query['back_to'])
144 elif response.status == FAILURE:151 elif response.status == FAILURE: