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 * Added a signal handler for SIGTERM, so you folks killing your
bots uncleanly won't have as many bugs :) bots uncleanly won't have as many bugs :)

View File

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

View File

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