From a37147e49198b39b437d58f8886160620ce1353e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 29 Oct 2012 15:02:44 -0400 Subject: [PATCH] rss2email: allow config feed ordering to override datafile ordering --- rss2email.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rss2email.py b/rss2email.py index 2099921..8f8f5d6 100755 --- a/rss2email.py +++ b/rss2email.py @@ -1367,15 +1367,20 @@ class Feeds (list): feed.load_from_config(self.config) feed_names = set(feed.name for feed in self) - for section in self.config.sections(): + order = _collections.defaultdict(lambda: (1e3, '')) + for i,section in enumerate(self.config.sections()): if section.startswith('feed.'): name = section[len('feed.'):] + order[name] = (i, name) 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 key(feed): + return order[feed.name] + self.sort(key=key) def save(self): LOG.debug('save feed configuration to {}'.format(self.configfiles[-1])) -- 2.26.2