Correct mime type in entry.source.link[rel='self']

This commit is contained in:
Sam Ruby 2006-10-17 16:08:44 -04:00
parent 88d9dac1d0
commit 045d38c418
2 changed files with 11 additions and 2 deletions

View File

@ -187,11 +187,16 @@ def spiderFeed(feed):
# capture feed and data from the planet configuration file
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:
if link.rel == 'self': break
if link.rel == 'self':
link['type'] = feedtype
break
else:
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():
data.feed['planet_'+name] = value

View File

@ -58,6 +58,8 @@ class SpiderTest(unittest.TestCase):
# verify that the file timestamps match atom:updated
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(os.stat(files[2]).st_mtime,
calendar.timegm(data.entries[0].updated_parsed))
@ -82,5 +84,7 @@ class SpiderTest(unittest.TestCase):
data = feedparser.parse(workdir +
'/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)