Пример #1
0
 def testMissingDataFeed(self):
     data = {"feed": {}, "entries": [], "bozo": 0}
     feed = createFeedFromData(data=data)
     self.assertEqual(feed.title, "No Title provided")
     self.assertEqual(feed.author, "No Author provided")
     self.assertIsNone(feed.updated)
     self.assertIsNone(feed.url)
Пример #2
0
 def testRssInitFeed(self):
     feed = createFeedFromData(data=self.rssfeeddata)
     self.assertEqual(feed.title, self.rssfeeddata["feed"]["title"])
     self.assertEqual(feed.updated, \
             self.rssfeeddata["feed"]["updated_parsed"])
     self.assertEqual(feed.author, \
             self.rssfeeddata["feed"]["author"])
     self.assertEqual(feed.homepage, self.rssfeeddata["feed"]["link"])
     self.assertEqual(feed.url,
                      self.rssfeeddata["feed"]["links"][0]["href"])
Пример #3
0
 def update(self):
     updated = []
     for feed in self.feeds:
         newfeed = createFeedFromData(feedparser.parse(feed.url))
         if newfeed is not None:
             updateinfo = {'title':feed.title, 'keys':[], 'entries':[]}
             # These things should actually not be set from the update
             # the user may have changed at least the title
             #feed.title = newfeed.title
             #feed.url = newfeed.url
             #feed.author = newfeed.author
             #feed.homepage = newfeed.homepage
             if feed.updated != newfeed.updated:
                 feed.updated = newfeed.updated
                 updateinfo["keys"].append("updated")
             for entry in newfeed.entries:
                 if not entry in feed.entries and not entry.identity in feed.deleted_entry_ids:
                     updateinfo["entries"].append(entry)
                     feed.entries.append(entry)
             updated.append(updateinfo)
     return updated
Пример #4
0
 def testErrorInParsing(self):
     data = {"bozo": 1}
     feed = createFeedFromData(data=data)
     self.assertIsNone(feed)
Пример #5
0
 def addFeed(self):
     dlg = uic.loadUi("addfeeddlg.ui", QtGui.QDialog(self))
     if dlg.exec_() == QtGui.QDialog.Accepted:
         data = feedparser.parse(dlg.url.text())
         feed = createFeedFromData(data)
         self.feedModel.addFeed(feed)