If a friend retrieved from Facebook has a picture, replace the URL with
authorAndrew Flegg <andrew@bleb.org>
Sun, 2 Jan 2011 13:38:15 +0000 (13:38 +0000)
committerAndrew Flegg <andrew@bleb.org>
Sun, 2 Jan 2011 19:58:03 +0000 (19:58 +0000)
the 302-redirecting one, which allows access to the large-format image.
Fixes MB#11736, reported by lots of people.

package/src/org/maemo/hermes/engine/facebook/api.py

index 19d57ed..1a2a3c7 100644 (file)
@@ -39,15 +39,11 @@ class FacebookApi():
            The result is a list of users:
            http://developers.facebook.com/docs/reference/api/user/'''
 
-        def copy(data, from_key, to, to_key = None):
-            if not to_key:
-                to_key = from_key
-                
-            if from_key in data:
-                to[to_key] = data[from_key]
-
-        users = self._request('https://graph.facebook.com/me/friends', {'fields': 'id,name,link,birthday,website,picture', 'type': 'large'})
-        return users['data']
+        users = self._request('https://graph.facebook.com/me/friends', {'fields': 'id,name,link,birthday,website,picture'})['data']
+        for user in users:
+            if 'picture' in user:
+                user['picture'] = 'https://graph.facebook.com/%s/picture?type=large&access_token=%s' % (user['id'], self._oauth.get_access_token())
+        return users
     
     
     # -----------------------------------------------------------------------