Example #1
0
 def _import_opml(self, selected_file):
     opml_parser = OpmlParser()
     try:
         opml_parser.parse(selected_file)
         with open(self.file_path, 'a+') as links_file:
             for feed in opml_parser.feeds:
                 if re.search(r'(.*), (.*)', feed):
                     links_file.write(feed + '\n')
                 else:
                     self._throw_import_error()
     except KeyError:
         self._throw_import_error()
Example #2
0
 def _import_opml(self, selected_file):
     opml_parser = OpmlParser()
     try:
         opml_parser.parse(selected_file)
         with open(self.file_path, 'a+') as links_file:
             for feed in opml_parser.feeds:
                 if re.search(r'(.*), (.*)', feed):
                     links_file.write(feed + '\n')
                 else:
                     self._throw_import_error()
     except KeyError:
         self._throw_import_error()
Example #3
0
 def test_opml_item(self):
     parser = OpmlParser()
     parser.parse('export_feeds_opml.opml')
     splited_item = parser.feeds[0].split(', ')
     self.assertEqual('PC Mania', splited_item[0])
     self.assertEqual('http://pcmania.bg/feed.php', splited_item[1])
Example #4
0
 def test_opml_items(self):
     parser = OpmlParser()
     parser.parse('export_feeds_opml.opml')
     self.assertEqual(len(parser.feeds), 2)