mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-26 13:01:06 -05:00
RSS: use the original FeedParserDict for substitution
instead of building a new keyword arguments dict by iteration. 'description' is a field in FeedParserDict, but is not present when iterating, which made it unavailable as a substitution variable.
This commit is contained in:
parent
2d30b40a80
commit
4f280599e1
@ -406,10 +406,10 @@ class RSS(callbacks.Plugin):
|
|||||||
template = self.registryValue(key_name, channel)
|
template = self.registryValue(key_name, channel)
|
||||||
date = entry.get('published_parsed')
|
date = entry.get('published_parsed')
|
||||||
date = utils.str.timestamp(date)
|
date = utils.str.timestamp(date)
|
||||||
s = string.Template(template).safe_substitute(
|
s = string.Template(template).substitute(
|
||||||
|
entry,
|
||||||
feed_name=feed.name,
|
feed_name=feed.name,
|
||||||
date=date,
|
date=date)
|
||||||
**entry)
|
|
||||||
return self._normalize_entry(s)
|
return self._normalize_entry(s)
|
||||||
|
|
||||||
def announce_entry(self, irc, channel, feed, entry):
|
def announce_entry(self, irc, channel, feed, entry):
|
||||||
|
@ -210,6 +210,16 @@ class RSSTestCase(ChannelPluginTestCase):
|
|||||||
self._feedMsg('rss remove xkcd2')
|
self._feedMsg('rss remove xkcd2')
|
||||||
feedparser._open_resource = old_open
|
feedparser._open_resource = old_open
|
||||||
|
|
||||||
|
def testDescription(self):
|
||||||
|
with conf.supybot.plugins.RSS.format.context('$description'):
|
||||||
|
old_open = feedparser._open_resource
|
||||||
|
feedparser._open_resource = constant(xkcd_new)
|
||||||
|
try:
|
||||||
|
self.assertRegexp('rss http://xkcd.com/rss.xml',
|
||||||
|
'Although the oral exam for the doctorate was')
|
||||||
|
finally:
|
||||||
|
feedparser._open_resource = old_open
|
||||||
|
|
||||||
if network:
|
if network:
|
||||||
def testRssinfo(self):
|
def testRssinfo(self):
|
||||||
self.assertNotError('rss info %s' % url)
|
self.assertNotError('rss info %s' % url)
|
||||||
@ -248,4 +258,5 @@ class RSSTestCase(ChannelPluginTestCase):
|
|||||||
self.assertNotError('rss info http://br-linux.org/main/index.xml')
|
self.assertNotError('rss info http://br-linux.org/main/index.xml')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user