Correct mime type in entry.source.link[rel='self']
This commit is contained in:
parent
88d9dac1d0
commit
045d38c418
@ -187,11 +187,16 @@ def spiderFeed(feed):
|
|||||||
|
|
||||||
# capture feed and data from the planet configuration file
|
# capture feed and data from the planet configuration file
|
||||||
if not data.feed.has_key('links'): data.feed['links'] = list()
|
if not data.feed.has_key('links'): data.feed['links'] = list()
|
||||||
|
feedtype = 'application/atom+xml'
|
||||||
|
if data.version.startswith('rss'): feedtype = 'application/rss+xml'
|
||||||
|
if data.version in ['rss090','rss10']: feedtype = 'application/rdf+xml'
|
||||||
for link in data.feed.links:
|
for link in data.feed.links:
|
||||||
if link.rel == 'self': break
|
if link.rel == 'self':
|
||||||
|
link['type'] = feedtype
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
data.feed.links.append(feedparser.FeedParserDict(
|
data.feed.links.append(feedparser.FeedParserDict(
|
||||||
{'rel':'self', 'type':'application/atom+xml', 'href':feed}))
|
{'rel':'self', 'type':feedtype, 'href':feed}))
|
||||||
for name, value in config.feed_options(feed).items():
|
for name, value in config.feed_options(feed).items():
|
||||||
data.feed['planet_'+name] = value
|
data.feed['planet_'+name] = value
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ class SpiderTest(unittest.TestCase):
|
|||||||
|
|
||||||
# verify that the file timestamps match atom:updated
|
# verify that the file timestamps match atom:updated
|
||||||
data = feedparser.parse(files[2])
|
data = feedparser.parse(files[2])
|
||||||
|
self.assertEqual(['application/atom+xml'], [link.type
|
||||||
|
for link in data.entries[0].source.links if link.rel=='self'])
|
||||||
self.assertEqual('one', data.entries[0].source.planet_name)
|
self.assertEqual('one', data.entries[0].source.planet_name)
|
||||||
self.assertEqual(os.stat(files[2]).st_mtime,
|
self.assertEqual(os.stat(files[2]).st_mtime,
|
||||||
calendar.timegm(data.entries[0].updated_parsed))
|
calendar.timegm(data.entries[0].updated_parsed))
|
||||||
@ -82,5 +84,7 @@ class SpiderTest(unittest.TestCase):
|
|||||||
|
|
||||||
data = feedparser.parse(workdir +
|
data = feedparser.parse(workdir +
|
||||||
'/planet.intertwingly.net,2006,testfeed3,1')
|
'/planet.intertwingly.net,2006,testfeed3,1')
|
||||||
|
self.assertEqual(['application/rss+xml'], [link.type
|
||||||
|
for link in data.entries[0].source.links if link.rel=='self'])
|
||||||
self.assertEqual('three', data.entries[0].source.author_detail.name)
|
self.assertEqual('three', data.entries[0].source.author_detail.name)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user