From: W. Trevor King Date: Wed, 23 Jan 2013 22:51:50 +0000 (-0500) Subject: feed: Pass config and section arguments to get_message() X-Git-Tag: v3.0~14 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f89c64c88bfd29966df45fe9328914d050880053;p=rss2email.git 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 --- 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):