Merge lp:~daker/loco-team-portal/fix.734520 into lp:loco-team-portal

Proposed by Adnane Belmadiaf
Status: Merged
Approved by: Adnane Belmadiaf
Approved revision: 470
Merged at revision: 536
Proposed branch: lp:~daker/loco-team-portal/fix.734520
Merge into: lp:loco-team-portal
Diff against target: 56 lines (+11/-11)
2 files modified
loco_directory/common/launchpad.py (+9/-7)
loco_directory/userprofiles/management/commands/update-profiles.py (+2/-4)
To merge this branch: bzr merge lp:~daker/loco-team-portal/fix.734520
Reviewer Review Type Date Requested Status
Chris Johnston Approve
Review via email: mp+68998@code.launchpad.net

Commit message

Workarround to get mugshot working

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

I'm still getting a link to https://api.launchpad.net/1.0/~persaudsamuel/logo in one of the events which results in: Object: <canonical.launchpad.rest.bytestorage.LibraryBackedByteStorage object at 0x2b007914e450>, name: 'logo'

review: Needs Fixing
Revision history for this message
Adnane Belmadiaf (daker) wrote :

That's wired , are you sure this user was updated when running update-profiles command ?

Revision history for this message
Adnane Belmadiaf (daker) wrote :

Can someone retest this pls.

Revision history for this message
Chris Johnston (cjohnston) wrote :

Text conflict in loco_directory/templates/events/team_event_detail_attendees.inc.html
1 conflicts encountered.

Please fix the conflict and I will test again. Thanks

review: Needs Fixing
Revision history for this message
Adnane Belmadiaf (daker) wrote :

Can you retest it pls ?

Revision history for this message
Chris Johnston (cjohnston) :
review: Approve
Revision history for this message
Tarmac WebDev (tarmac-webdev) wrote :

Attempt to merge into lp:loco-team-portal failed due to conflicts:

text conflict in loco_directory/templates/events/team_event_detail_attendees.inc.html

470. By Adnane Belmadiaf

Fixed the merge conflict

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-10-05 00:50:53 +0000
3+++ loco_directory/common/launchpad.py 2012-06-20 10:51:18 +0000
4@@ -8,6 +8,7 @@
5
6 import os
7 import sys
8+import urllib2
9
10 def is_debug_user(username):
11 try:
12@@ -58,16 +59,17 @@
13 if is_debug_user(username):
14 return True
15
16-def get_mugshot_url(lp, identity):
17- # Not ideal, but until LP #336943
18+def get_mugshot_url(url):
19+ # Not ideal, but until LP #713873
20 # or similar, we are in a hard spot.
21 # When this bug is fixed, this can be made cleaner.
22 try:
23- lp.people[identity].mugshot.open()
24- return lp.people[identity].mugshot_link or "https://api.launchpad.net/1.0/~%s/mugshot" % (identity)
25- except HTTPError:
26- # 404 or some other issue that means we should default to False
27- return "https://api.launchpad.net/1.0/ubuntu/mugshot"
28+ con = urllib2.urlopen(url)
29+ con.close()
30+ return url
31+ except urllib2.HTTPError, e:
32+ # 404 or some other issue that means we should default to False
33+ return "https://launchpad.net/@@/person-logo"
34
35 def get_user_timezone(username, lp=None):
36 timezone = 'UTC'
37
38=== modified file 'loco_directory/userprofiles/management/commands/update-profiles.py'
39--- loco_directory/userprofiles/management/commands/update-profiles.py 2010-12-28 21:41:10 +0000
40+++ loco_directory/userprofiles/management/commands/update-profiles.py 2012-06-20 10:51:18 +0000
41@@ -25,13 +25,11 @@
42 if not ld_user.username in USER_BLACKLIST:
43 profile, created = UserProfile.objects.get_or_create(user=ld_user)
44 try:
45+ print "updating %s" % ld_user
46 lp_user = lp.people[ld_user.username]
47 profile.tz = lp_user.time_zone or "UTC"
48 profile.realname = lp_user.display_name or user.username
49- if lp_user.logo_link.startswith("https://") :
50- profile.mugshot = lp_user.logo_link
51- else:
52- profile.mugshot = "https://launchpad.net/@@/person-logo"
53+ profile.mugshot = launchpad.get_mugshot_url(lp_user.logo_link)
54 profile.save()
55 except Exception, e:
56 print "Error updating %s" % ld_user

Subscribers

People subscribed via source and target branches