Merge lp:~verterok/unity-scope-openclipart/fix-metadata-published-key into lp:unity-scope-openclipart

Proposed by Guillermo Gonzalez
Status: Merged
Approved by: James Henstridge
Approved revision: 27
Merged at revision: 26
Proposed branch: lp:~verterok/unity-scope-openclipart/fix-metadata-published-key
Merge into: lp:unity-scope-openclipart
Diff against target: 64 lines (+16/-11)
1 file modified
src/unity_openclipart_daemon.py (+16/-11)
To merge this branch: bzr merge lp:~verterok/unity-scope-openclipart/fix-metadata-published-key
Reviewer Review Type Date Requested Status
James Henstridge Approve
PS Jenkins bot (community) continuous-integration Approve
David Callé Approve
Review via email: mp+165238@code.launchpad.net

Commit message

Use 'updated' key for the published metadata field if 'published' isn't there.

Description of the change

Use 'updated' key for the published metadata field if 'published' isn't there.

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

support both published and updated keys (feedparser >= 5.1)

Revision history for this message
David Callé (davidc3) wrote :

LGTM +1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
James Henstridge (jamesh) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity_openclipart_daemon.py'
2--- src/unity_openclipart_daemon.py 2013-04-23 15:32:59 +0000
3+++ src/unity_openclipart_daemon.py 2013-05-22 20:47:29 +0000
4@@ -2,16 +2,16 @@
5 # -*- coding: utf-8 -*-
6
7 # Copyright(C) 2013 Canonical, ltd.
8-# This program is free software: you can redistribute it and/or modify it
9-# under the terms of the GNU General Public License version 3, as published
10+# This program is free software: you can redistribute it and/or modify it
11+# under the terms of the GNU General Public License version 3, as published
12 # by the Free Software Foundation.
13-#
14-# This program is distributed in the hope that it will be useful, but
15-# WITHOUT ANY WARRANTY; without even the implied warranties of
16-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
17+#
18+# This program is distributed in the hope that it will be useful, but
19+# WITHOUT ANY WARRANTY; without even the implied warranties of
20+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
21 # PURPOSE. See the GNU General Public License for more details.
22-#
23-# You should have received a copy of the GNU General Public License along
24+#
25+# You should have received a copy of the GNU General Public License along
26 # with this program. If not, see <http://www.gnu.org/licenses/>.
27
28 from gi.repository import Unity, UnityExtras
29@@ -93,11 +93,16 @@
30 for link in f['links']:
31 if link['rel'] == 'enclosure':
32 resource = link['href']
33+ if 'published' not in f:
34+ # support feedparser == 5.1
35+ published = f['updated']
36+ else:
37+ published = f['published']
38 results.append({'uri':f['link'],
39 'icon':f['media_thumbnail'][0]['url'],
40 'title':f['title'],
41 'comment':f['summary'],
42- 'published':f['published'],
43+ 'published':published,
44 'author':f['author'],
45 'resource':resource})
46 except Exception as error:
47@@ -159,7 +164,7 @@
48 icon = Gio.FileIcon.new (Gio.file_new_for_path(PROVIDER_ICON))
49 view_action = Unity.PreviewAction.new("view", _("View"), icon)
50 preview.add_action(view_action)
51-
52+
53 if resource and shutil.which("inkscape"):
54 inkscape_action = Unity.PreviewAction.new("inkscape", _("Open in Inkscape"), None)
55 preview.add_action(inkscape_action)
56@@ -203,7 +208,7 @@
57 '''
58 fs = Unity.FilterSet.new ()
59 # if FILTERS:
60-#
61+#
62 return fs
63
64 def do_get_group_name (self):

Subscribers

People subscribed via source and target branches