From dbc093928cd86d9dc81649dcd40864be1cb576c7 Mon Sep 17 00:00:00 2001 From: Andrew Flegg Date: Sun, 2 Jan 2011 13:38:15 +0000 Subject: [PATCH] If a friend retrieved from Facebook has a picture, replace the URL with the 302-redirecting one, which allows access to the large-format image. Fixes MB#11736, reported by lots of people. --- .../src/org/maemo/hermes/engine/facebook/api.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/package/src/org/maemo/hermes/engine/facebook/api.py b/package/src/org/maemo/hermes/engine/facebook/api.py index 19d57ed..1a2a3c7 100644 --- a/package/src/org/maemo/hermes/engine/facebook/api.py +++ b/package/src/org/maemo/hermes/engine/facebook/api.py @@ -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 # ----------------------------------------------------------------------- -- 1.7.9.5