Merge lp:~max-rabkin/ibid/feed-link into lp:~ibid-core/ibid/old-trunk-1.6

Proposed by Max Rabkin
Status: Merged
Approved by: Jonathan Hitchcock
Approved revision: 936
Merged at revision: 935
Proposed branch: lp:~max-rabkin/ibid/feed-link
Merge into: lp:~ibid-core/ibid/old-trunk-1.6
Diff against target: 36 lines (+10/-3)
1 file modified
ibid/plugins/feeds.py (+10/-3)
To merge this branch: bzr merge lp:~max-rabkin/ibid/feed-link
Reviewer Review Type Date Requested Status
Jonathan Hitchcock Approve
Michael Gorven Approve
Stefano Rivera Approve
Review via email: mp+24977@code.launchpad.net

Commit message

Include link in feed updates, don't choke on entries with no links

To post a comment you must log in.
Revision history for this message
Stefano Rivera (stefanor) :
review: Approve
Revision history for this message
Michael Gorven (mgorven) wrote :

 review approve

review: Approve
Revision history for this message
Jonathan Hitchcock (vhata) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ibid/plugins/feeds.py'
2--- ibid/plugins/feeds.py 2010-03-27 15:50:58 +0000
3+++ ibid/plugins/feeds.py 2010-05-10 10:15:41 +0000
4@@ -275,9 +275,9 @@
5 else:
6 summary = article.content[0].value
7
8- event.addresponse(u'"%(title)s" %(link)s : %(summary)s', {
9+ event.addresponse(u'"%(title)s"%(link)s : %(summary)s', {
10 'title': html2text_file(article.title, None).strip(),
11- 'link': article.link,
12+ 'link': get_link(article),
13 'summary': summary,
14 })
15
16@@ -309,12 +309,19 @@
17 seen[id] = entry.updated_parsed
18 if entry.updated_parsed != old_seen.get(id):
19 event.addresponse(
20- u"%(status)s item in %(feed)s: %(title)s", {
21+ u"%(status)s item in %(feed)s: %(title)s%(link)s", {
22 'status': id in old_seen and u'Updated' or u'New',
23 'feed': feed.name,
24 'title': entry.title,
25+ 'link': get_link(entry),
26 },
27 source=feed.source, target=feed.target, adress=False)
28 self.last_seen[feed.name] = seen
29
30+def get_link(entry):
31+ if hasattr(entry, 'link'):
32+ return u' <%s>' % entry.link
33+ else:
34+ return u''
35+
36 # vi: set et sta sw=4 ts=4:

Subscribers

People subscribed via source and target branches