Michael Hall has proposed merging lp:~mhall119/loco-directory/fixes-728766 into
lp:loco-directory.
Requested reviews:
loco-directory-dev (loco-directory-dev)
Related bugs:
#728766 Crash when running lpupdate
https://bugs.launchpad.net/bugs/728766
For more details, see:
https://code.launchpad.net/~mhall119/loco-directory/fixes-728766/+merge/52236
This will allow lpupdate to keep profiles in sync with LP, while avoiding the
errors caused by duplicate openid claims.
--
https://code.launchpad.net/~mhall119/loco-directory/fixes-728766/+merge/52236
Your team loco-directory-dev is requested to review the proposed merge of
lp:~mhall119/loco-directory/fixes-728766 into lp:loco-directory.
=== modified file 'loco_directory/common/launchpad.py'
--- loco_directory/common/launchpad.py 2011-02-18 21:58:32 +0000
+++ loco_directory/common/launchpad.py 2011-03-04 18:20:42 +0000
@@ -110,8 +110,13 @@
openid_assoc = openids[0]
openid = get_permanent_openid_from_username(user.username)
if openid is not None:
- if force:
- UserOpenID.objects.filter(claimed_id=openid.local_id).delete()
+ claimed_by = UserOpenID.objects.filter(claimed_id=openid.local_id)
+ if bool(claimed_by):
+ if force:
+ claimed_by.delete()
+ else:
+ return False
+
openid_assoc.claimed_id = openid.local_id
openid_assoc.display_id = openid.local_id
openid_assoc.save()
=== modified file 'loco_directory/userprofiles/models.py'
--- loco_directory/userprofiles/models.py 2011-01-23 04:30:02 +0000
+++ loco_directory/userprofiles/models.py 2011-03-04 18:20:42 +0000
@@ -73,7 +73,7 @@
if created:
user.save()
from common import launchpad
- launchpad.set_user_openid(user)
+ launchpad.set_user_openid(user, force=True)
profile, created = UserProfile.objects.get_or_create(user=user)
if created:
# set real name as username for now,
_______________________________________________
Mailing list: https://launchpad.net/~loco-directory-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~loco-directory-dev
More help : https://help.launchpad.net/ListHelp