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
1=== modified file 'ibid/plugins/feeds.py'
2--- ibid/plugins/feeds.py 2009-12-29 15:56:52 +0000
3+++ ibid/plugins/feeds.py 2010-01-06 23:22:11 +0000
4@@ -72,9 +72,13 @@
5 self.time = datetime.utcnow()
6 self.update()
7
8- def update(self):
9+ def update(self, max_age=None):
10+ headers = {}
11+ if max_age:
12+ headers['Cache-Control'] = 'max-age=%i' % max_age
13+
14 feedfile = cacheable_download(self.url, "feeds/%s-%i.xml" % (
15- re.sub(r'\W+', '_', self.name), self.identity_id))
16+ re.sub(r'\W+', '_', self.name), self.identity_id), headers)
17 self.feed = feedparser.parse(feedfile)
18 self.entries = self.feed['entries']
19
20@@ -280,7 +284,7 @@
21 .filter(Feed.target != None).all()
22
23 for feed in feeds:
24- feed.update()
25+ feed.update(max_age=self.interval)
26 if not feed.entries:
27 log.warning(u'Error polling feed %s', feed.name)
28 continue
29
30=== modified file 'ibid/utils/__init__.py'
31--- ibid/utils/__init__.py 2010-01-02 18:02:26 +0000
32+++ ibid/utils/__init__.py 2010-01-06 23:22:11 +0000
33@@ -74,7 +74,7 @@
34 exists = os.path.isfile(cachefile)
35
36 req = urllib2.Request(url_to_bytestring(url))
37- for name, value in headers:
38+ for name, value in headers.iteritems():
39 req.add_header(name, value)
40 if not req.has_header('user-agent'):
41 req.add_header('User-Agent', 'Ibid/' + (ibid_version() or 'dev'))

Subscribers

People subscribed via source and target branches