From f89c64c88bfd29966df45fe9328914d050880053 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 23 Jan 2013 17:51:50 -0500 Subject: [PATCH] feed: Pass config and section arguments to get_message() Otherwise it will always use the default config. Also add section fallback code to get_message in case the feed-specific section is not in the config file. This is useful for testing, although in production every feed should have a section to hold it's URL. Signed-off-by: W. Trevor King --- rss2email/email.py | 2 ++ rss2email/feed.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rss2email/email.py b/rss2email/email.py index b8ccdd4..6f33379 100644 --- a/rss2email/email.py +++ b/rss2email/email.py @@ -86,6 +86,8 @@ def get_message(sender, recipient, subject, body, content_type, """ if config is None: config = _config.CONFIG + if section not in config.sections(): + section = 'DEFAULT' encodings = [ x.strip() for x in config.get(section, 'encodings').split(',')] diff --git a/rss2email/feed.py b/rss2email/feed.py index 9a1c709..3621a0b 100644 --- a/rss2email/feed.py +++ b/rss2email/feed.py @@ -438,7 +438,9 @@ class Feed (object): subject=subject, body=content['value'], content_type=content['type'].split('/', 1)[1], - extra_headers=extra_headers) + extra_headers=extra_headers, + config=self.config, + section=self.section) return (guid, id_, sender, message) def _get_entry_id(self, entry): -- 2.26.2