Merge lp:~stefanor/ibid/feeds-refresh-504016 into lp:~ibid-core/ibid/old-trunk-1.6

Proposed by Stefano Rivera on 2010-01-06
Status: Merged
Approved by: Michael Gorven on 2010-01-07
Approved revision: 830
Merged at revision: 830
Proposed branch: lp:~stefanor/ibid/feeds-refresh-504016
Merge into: lp:~ibid-core/ibid/old-trunk-1.6
Diff against target: 41 lines (+8/-4)
2 files modified
ibid/plugins/feeds.py (+7/-3)
ibid/utils/__init__.py (+1/-1)
To merge this branch: bzr merge lp:~stefanor/ibid/feeds-refresh-504016
Reviewer Review Type Date Requested Status
Michael Gorven Approve on 2010-01-07
Jonathan Hitchcock 2010-01-06 Needs Fixing on 2010-01-06
Review via email: mp+16932@code.launchpad.net
To post a comment you must log in.
Jonathan Hitchcock (vhata) wrote :

You have a conflict in your diff.

review: Needs Fixing
Stefano Rivera (stefanor) wrote :

> You have a conflict in your diff.

r830

830. By Stefano Rivera on 2010-01-06

Merge from trunk

Michael Gorven (mgorven) wrote :

 review approve
 status approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ibid/plugins/feeds.py'
--- ibid/plugins/feeds.py 2009-12-29 15:56:52 +0000
+++ ibid/plugins/feeds.py 2010-01-06 23:22:11 +0000
@@ -72,9 +72,13 @@
72 self.time = datetime.utcnow()72 self.time = datetime.utcnow()
73 self.update()73 self.update()
7474
75 def update(self):75 def update(self, max_age=None):
76 headers = {}
77 if max_age:
78 headers['Cache-Control'] = 'max-age=%i' % max_age
79
76 feedfile = cacheable_download(self.url, "feeds/%s-%i.xml" % (80 feedfile = cacheable_download(self.url, "feeds/%s-%i.xml" % (
77 re.sub(r'\W+', '_', self.name), self.identity_id))81 re.sub(r'\W+', '_', self.name), self.identity_id), headers)
78 self.feed = feedparser.parse(feedfile)82 self.feed = feedparser.parse(feedfile)
79 self.entries = self.feed['entries']83 self.entries = self.feed['entries']
8084
@@ -280,7 +284,7 @@
280 .filter(Feed.target != None).all()284 .filter(Feed.target != None).all()
281285
282 for feed in feeds:286 for feed in feeds:
283 feed.update()287 feed.update(max_age=self.interval)
284 if not feed.entries:288 if not feed.entries:
285 log.warning(u'Error polling feed %s', feed.name)289 log.warning(u'Error polling feed %s', feed.name)
286 continue290 continue
287291
=== modified file 'ibid/utils/__init__.py'
--- ibid/utils/__init__.py 2010-01-02 18:02:26 +0000
+++ ibid/utils/__init__.py 2010-01-06 23:22:11 +0000
@@ -74,7 +74,7 @@
74 exists = os.path.isfile(cachefile)74 exists = os.path.isfile(cachefile)
7575
76 req = urllib2.Request(url_to_bytestring(url))76 req = urllib2.Request(url_to_bytestring(url))
77 for name, value in headers:77 for name, value in headers.iteritems():
78 req.add_header(name, value)78 req.add_header(name, value)
79 if not req.has_header('user-agent'):79 if not req.has_header('user-agent'):
80 req.add_header('User-Agent', 'Ibid/' + (ibid_version() or 'dev'))80 req.add_header('User-Agent', 'Ibid/' + (ibid_version() or 'dev'))

Subscribers

People subscribed via source and target branches