Merge lp:~davidc3/unity-lens-photos/fb-deleted-photos-previews into lp:unity-lens-photos

Proposed by David Callé
Status: Merged
Merged at revision: 161
Proposed branch: lp:~davidc3/unity-lens-photos/fb-deleted-photos-previews
Merge into: lp:unity-lens-photos
Diff against target: 58 lines (+24/-20)
1 file modified
src/unity_facebook_daemon.py (+24/-20)
To merge this branch: bzr merge lp:~davidc3/unity-lens-photos/fb-deleted-photos-previews
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+211481@code.launchpad.net

Commit message

Catch errors when previewing FB deleted photos, fallback on existing result data

Description of the change

Catch errors when previewing FB deleted photos, fallback on existing result data

 * Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes) : yes
 * Did you build your software in a clean sbuild/pbuilder chroot or ppa? : yes
 * Has your component "TestPlan” been executed successfully on desktop? : yes
 * If you changed the packaging (debian), did you subscribe a core-dev to this MP? : N/A
 * If you changed the UI, did you subscribe the design-reviewers to this MP? : N/A
 * What components might get impacted by your changes? : none

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michal Hruby (mhr3) wrote :

Looks fine...

* Are any changes against your component pending/needed to land the MP under review in a functional state and are those called out explicitly by the submitter?

No pending changes.

 * Did you do exploratory testing related to the component you own with the MP changeset included?

No.

 * Has the submitter requested review by all the relevant teams/reviewres?

Yes.

 * If you are the reviewer owning the component the MP is against, have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?

Yes.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity_facebook_daemon.py'
2--- src/unity_facebook_daemon.py 2014-03-18 10:25:30 +0000
3+++ src/unity_facebook_daemon.py 2014-03-18 10:37:57 +0000
4@@ -524,30 +524,34 @@
5 else:
6 fql = {'q':'{"query1":"SELECT images, owner, link, caption, created, place_id, album_object_id, position FROM photo WHERE object_id=%s","query2":"SELECT subject, text FROM photo_tag WHERE object_id=%s","query3":"SELECT username, name FROM user WHERE uid IN (SELECT owner FROM #query1)","query4":"SELECT name FROM place WHERE page_id IN (SELECT place_id FROM #query1)","query5":"SELECT name, size FROM album WHERE object_id IN (SELECT album_object_id FROM #query1)"}' % (oid, oid)}
7 url = 'https://graph.facebook.com/fql?%s&access_token=%s' % (urllib.parse.urlencode(fql), self._auth_token)
8- raw_results = urllib.request.urlopen(url).read ()
9- meta = json.loads(raw_results.decode("utf8"))
10+ try:
11+ raw_results = urllib.request.urlopen(url).read ()
12+ meta = json.loads(raw_results.decode("utf8"))
13+ except urllib.error.HTTPError:
14+ meta = None
15 link, caption, image, date = None, None, None, None
16 subject, tags, album, position = None, None, None, None
17 place, name, username, album_size = None, None, None, None
18 tag_list = []
19- for m in meta['data'][0]['fql_result_set']:
20- date = datetime.datetime.fromtimestamp(m['created']).strftime('%d %b %Y')
21- link = m['link']
22- caption = m['caption']
23- position = m['position']
24- image = m['images'][0]['source']
25- for m in meta['data'][1]['fql_result_set']:
26- if m['text'] not in tag_list:
27- tag_list.append(m['text'])
28- tags = ", ".join(tag_list)
29- for m in meta['data'][2]['fql_result_set']:
30- username = m['username']
31- name = m['name']
32- for m in meta['data'][3]['fql_result_set']:
33- place = m['name']
34- for m in meta['data'][4]['fql_result_set']:
35- album = m['name']
36- album_size = m['size']
37+ if meta:
38+ for m in meta['data'][0]['fql_result_set']:
39+ date = datetime.datetime.fromtimestamp(m['created']).strftime('%d %b %Y')
40+ link = m['link']
41+ caption = m['caption']
42+ position = m['position']
43+ image = m['images'][0]['source']
44+ for m in meta['data'][1]['fql_result_set']:
45+ if m['text'] not in tag_list:
46+ tag_list.append(m['text'])
47+ tags = ", ".join(tag_list)
48+ for m in meta['data'][2]['fql_result_set']:
49+ username = m['username']
50+ name = m['name']
51+ for m in meta['data'][3]['fql_result_set']:
52+ place = m['name']
53+ for m in meta['data'][4]['fql_result_set']:
54+ album = m['name']
55+ album_size = m['size']
56 return [link,caption, image, subject, tags, username, name, place, date, album, position, album_size]
57
58 if __name__ == '__main__':

Subscribers

People subscribed via source and target branches

to all changes: