Merge lp:~mhall119/loco-team-portal/fixes-728766 into lp:loco-team-portal

Proposed by Michael Hall
Status: Merged
Approved by: Chris Johnston
Approved revision: 415
Merged at revision: 416
Proposed branch: lp:~mhall119/loco-team-portal/fixes-728766
Merge into: lp:loco-team-portal
Diff against target: 32 lines (+8/-3)
2 files modified
loco_directory/common/launchpad.py (+7/-2)
loco_directory/userprofiles/models.py (+1/-1)
To merge this branch: bzr merge lp:~mhall119/loco-team-portal/fixes-728766
Reviewer Review Type Date Requested Status
Chris Johnston Approve
Review via email: mp+52236@code.launchpad.net

Description of the change

This will allow lpupdate to keep profiles in sync with LP, while avoiding the errors caused by duplicate openid claims.

To post a comment you must log in.
Revision history for this message
Chris Johnston (cjohnston) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loco_directory/common/launchpad.py'
2--- loco_directory/common/launchpad.py 2011-02-18 21:58:32 +0000
3+++ loco_directory/common/launchpad.py 2011-03-04 18:20:42 +0000
4@@ -110,8 +110,13 @@
5 openid_assoc = openids[0]
6 openid = get_permanent_openid_from_username(user.username)
7 if openid is not None:
8- if force:
9- UserOpenID.objects.filter(claimed_id=openid.local_id).delete()
10+ claimed_by = UserOpenID.objects.filter(claimed_id=openid.local_id)
11+ if bool(claimed_by):
12+ if force:
13+ claimed_by.delete()
14+ else:
15+ return False
16+
17 openid_assoc.claimed_id = openid.local_id
18 openid_assoc.display_id = openid.local_id
19 openid_assoc.save()
20
21=== modified file 'loco_directory/userprofiles/models.py'
22--- loco_directory/userprofiles/models.py 2011-01-23 04:30:02 +0000
23+++ loco_directory/userprofiles/models.py 2011-03-04 18:20:42 +0000
24@@ -73,7 +73,7 @@
25 if created:
26 user.save()
27 from common import launchpad
28- launchpad.set_user_openid(user)
29+ launchpad.set_user_openid(user, force=True)
30 profile, created = UserProfile.objects.get_or_create(user=user)
31 if created:
32 # set real name as username for now,

Subscribers

People subscribed via source and target branches