Merge lp:~salgado/launchpad/use-master-store into lp:launchpad

Proposed by Guilherme Salgado
Status: Merged
Merged at revision: not available
Proposed branch: lp:~salgado/launchpad/use-master-store
Merge into: lp:launchpad
Diff against target: 28 lines (+5/-1)
2 files modified
lib/canonical/launchpad/webapp/login.py (+1/-1)
lib/canonical/launchpad/webapp/tests/test_login.py (+4/-0)
To merge this branch: bzr merge lp:~salgado/launchpad/use-master-store
Reviewer Review Type Date Requested Status
Tim Penhey (community) release-critical Approve
Review via email: mp+20390@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Guilherme Salgado (salgado) wrote :

When doing my previous changes to make sure the master database is used
when looking up Account/Person entries in OpenIDCallbackView.render() I
didn't realize the login() call would trigger other DB lookups, so left
it out of the with: block that runs with the MasterDatabasePolicy
installed.

That mistake is the cause of OOPS-1521ED286. This branch fixes it

Revision history for this message
Tim Penhey (thumper) wrote :

Looks fine.

review: Approve (release-critical)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/webapp/login.py'
2--- lib/canonical/launchpad/webapp/login.py 2010-02-26 22:05:40 +0000
3+++ lib/canonical/launchpad/webapp/login.py 2010-03-01 19:36:23 +0000
4@@ -307,8 +307,8 @@
5 removeSecurityProxy(account).createPerson(
6 PersonCreationRationale.OWNER_CREATED_LAUNCHPAD)
7 should_update_last_write = True
8+ self.login(account)
9
10- self.login(account)
11 if should_update_last_write:
12 # This is a GET request but we changed the database, so update
13 # session_data['last_write'] to make sure further requests use
14
15=== modified file 'lib/canonical/launchpad/webapp/tests/test_login.py'
16--- lib/canonical/launchpad/webapp/tests/test_login.py 2010-02-26 22:07:54 +0000
17+++ lib/canonical/launchpad/webapp/tests/test_login.py 2010-03-01 19:36:23 +0000
18@@ -56,6 +56,10 @@
19 def login(self, account):
20 super(StubbedOpenIDCallbackView, self).login(account)
21 self.login_called = True
22+ current_policy = getUtility(IStoreSelector).get_current()
23+ if not isinstance(current_policy, MasterDatabasePolicy):
24+ raise AssertionError(
25+ "Not using the master store: %s" % current_policy)
26
27
28 @contextmanager