Fix for slashdot bug, I think.

This commit is contained in:
Jeremy Fincher 2004-04-20 09:51:55 +00:00
parent 9a907277c1
commit 85807dd077
2 changed files with 11 additions and 4 deletions

View File

@ -159,11 +159,16 @@ class RSS(callbacks.Privmsg):
oldheadlines = [] oldheadlines = []
newresults = self.getFeed(url) newresults = self.getFeed(url)
newheadlines = self.getHeadlines(newresults) newheadlines = self.getHeadlines(newresults)
for headline in oldheadlines: def headlineEq(h1, h2):
return h1.lower().split() == h2.lower().split()
for (i, oldheadline) in enumerate(oldheadlines):
try: try:
newheadlines.remove(headline) newheadline = newheadlines[i]
except ValueError: except IndexError:
pass break
if headlineEq(oldheadline, newheadline):
newheadlines[i] = None
newheadlines = filter(None, newheadlines) # Removes Nones.
if newheadlines: if newheadlines:
for channel in channels: for channel in channels:
bold = self.registryValue('bold', channel) bold = self.registryValue('bold', channel)

View File

@ -44,6 +44,8 @@ if network:
def testRss(self): def testRss(self):
self.assertNotError('rss %s' % url) self.assertNotError('rss %s' % url)
m = self.assertNotError('rss %s' % url)
self.failUnless(m.args[1].count('||') == 1)
def testRssAdd(self): def testRssAdd(self):
self.assertNotError('rss add advogato %s' % url) self.assertNotError('rss add advogato %s' % url)