Update RSS.info to accept an rss feed name as well as a url

This commit is contained in:
James Vega 2004-04-21 07:38:18 +00:00
parent 28fe96c833
commit 173af6567f
3 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,5 @@
* Updated RSS.info to accept a feed name as well as a url.
* Added a signal handler for SIGTERM, so you folks killing your
bots uncleanly won't have as many bugs :)

View File

@ -322,12 +322,16 @@ class RSS(callbacks.Privmsg):
irc.reply(sep.join(headlines))
def info(self, irc, msg, args):
"""<url>
"""<url|feed>
Returns information from the given RSS feed, namely the title,
URL, description, and last update date, if available.
"""
url = privmsgs.getArgs(args)
try:
url = self.registryValue('feeds.%s' % url)
except registry.NonExistentRegistryEntry:
pass
feed = self.getFeed(url)
info = feed['channel']
if not info:

View File

@ -31,12 +31,15 @@
from testsupport import *
url = 'http://advogato.org/rss/articles.xml'
url = 'http://www.advogato.org/rss/articles.xml'
if network:
class RSSTestCase(PluginTestCase, PluginDocumentation):
plugins = ('RSS',)
def testRssinfo(self):
self.assertNotError('rss info %s' % url)
self.assertNotError('rss add advogato %s' % url)
self.assertNotError('rss info advogato')
self.assertNotError('rss info AdVogATo')
def testRssinfoDoesTimeProperly(self):
self.assertNotRegexp('rss info http://slashdot.org/slashdot.rss',
@ -44,7 +47,7 @@ if network:
def testRss(self):
self.assertNotError('rss %s' % url)
m = self.assertNotError('rss %s' % url)
m = self.assertNotError('rss %s 2' % url)
self.failUnless(m.args[1].count('||') == 1)
def testRssAdd(self):