rss2email.py: don't create config-only feeds if they were in the datafile.
authorW. Trevor King <wking@tremily.us>
Thu, 18 Oct 2012 17:31:07 +0000 (13:31 -0400)
committerW. Trevor King <wking@tremily.us>
Thu, 18 Oct 2012 17:34:49 +0000 (13:34 -0400)
rss2email.py

index 86b16e4cf6002269c3303cca96087bc0fdb51322..4fa7edbf98db5943647b6c3591a42bf5e8336fe0 100755 (executable)
@@ -1364,13 +1364,16 @@ class Feeds (list):
         for feed in self:
             feed.load_from_config(self.config)
 
+        feed_names = set(feed.name for feed in self)
         for section in self.config.sections():
             if section.startswith('feed.'):
                 name = section[len('feed.'):]
-                LOG.debug(
-                    ('feed {} not found feed file, initializing from config'
-                     ).format(name))
-                self.append(Feed(name=name, config=self.config))
+                if name not in feed_names:
+                    LOG.debug(
+                        ('feed {} not found in feed file, '
+                         'initializing from config').format(name))
+                    self.append(Feed(name=name, config=self.config))
+                    feed_names.add(name)
 
     def save(self):
         LOG.debug('save feed configuration to {}'.format(self.configfiles[-1]))