X-Git-Url: http://git.tremily.us/?p=rss2email.git;a=blobdiff_plain;f=rss2email%2Fconfig.py;h=e8e7141fa0dcd8ab060467cceee5287ed7abc71f;hp=11d5ccdfcb8d0d5378d2231486d513896cd666d3;hb=a97a8f0c9f50d98bd03c674b934ccadfe5064d7e;hpb=3a331d670d15dda6ecfca8af4fbff2a34d1176db diff --git a/rss2email/config.py b/rss2email/config.py index 11d5ccd..e8e7141 100644 --- a/rss2email/config.py +++ b/rss2email/config.py @@ -1,13 +1,16 @@ -# Copyright (C) 2004-2013 Aaron Swartz +# Copyright (C) 2004-2014 Aaron Swartz # Brian Lalor # Dean Jackson +# Dmitry Bogatov # Erik Hetzner # Etienne Millon +# George Saunders # Joey Hess # Lindsey Smith # Marcel Ackermann # Martin 'Joey' Schulze # Matej Cepl +# Thiago Coutinho # W. Trevor King # # This file is part of rss2email. @@ -40,12 +43,19 @@ class Config (_configparser.ConfigParser): super(Config, self).__init__( dict_type=dict_type, interpolation=interpolation, **kwargs) - def _setup(self, section='DEFAULT'): + def setup_html2text(self, section='DEFAULT'): + """Setup html2text globals to match our configuration + + Html2text unfortunately uses globals (instead of keyword + arguments) to configure its conversion. + """ + if section not in self: + section = 'DEFAULT' _html2text.UNICODE_SNOB = self.getboolean( - section, 'unicode-snob', fallback=False) + section, 'unicode-snob') _html2text.LINKS_EACH_PARAGRAPH = self.getboolean( - section, 'links-after-each-paragaph', fallback=False) - _html2text.BODY_WIDTH = self.getint(section, 'body-width', fallback=0) + section, 'links-after-each-paragraph') + _html2text.BODY_WIDTH = self.getint(section, 'body-width') CONFIG = Config() @@ -56,7 +66,7 @@ CONFIG['DEFAULT'] = _collections.OrderedDict(( # The email address messages are from by default ('from', 'user@rss2email.invalid'), # Transfer-Encoding. For local mailing it is safe and - # convient to use 8bit. + # convenient to use 8bit. ('use-8bit', str(False)), # True: Only use the 'from' address. # False: Use the email address specified by the feed, when possible. @@ -64,9 +74,11 @@ CONFIG['DEFAULT'] = _collections.OrderedDict(( # True: Use the publisher's email if you can't find the author's. # False: Just use the 'from' email instead. ('use-publisher-email', str(False)), - # Only use the feed email address rather than friendly name - # plus email address - ('friendly-name', str(True)), + # If empty, only use the feed email address rather than + # friendly name plus email address. Available attributes may + # include 'feed', 'feed-title', 'author', and 'publisher', but + # only 'feed' is guaranteed. + ('name-format', '{feed-title}: {author}'), # Set this to default To email addresses. ('to', ''), @@ -80,6 +92,9 @@ CONFIG['DEFAULT'] = _collections.OrderedDict(( # True: Fetch, process, and email feeds. # False: Don't fetch, process, or email feeds ('active', str(True)), + # True: Send a single, multi-entry email per feed per rss2email run. + # False: Send a single email per entry. + ('digest', str(False)), # True: Generate Date header based on item's date, when possible. # False: Generate Date header based on time sent. ('date-header', str(False)), @@ -94,6 +109,12 @@ CONFIG['DEFAULT'] = _collections.OrderedDict(( # True: Receive one email per post. # False: Receive an email every time a post changes. ('trust-guid', str(True)), + # True: Receive one email per unique link url. + # False: Defer to trust-guid preference. + # Toggling this for existing feeds may result in duplicates, + # because the old entries will not be recorded under their new + # link-based ids. + ('trust-link', str(False)), # To most correctly encode emails with international # characters, we iterate through the list below and use the # first character set that works. @@ -101,6 +122,12 @@ CONFIG['DEFAULT'] = _collections.OrderedDict(( # User processing hooks. Note the space after the module name. # Example: post-process = 'rss2email.post_process.downcase downcase_message' ('post-process', ''), + # User processing hooks for digest messages. If 'digest' is + # enabled, the usual 'post-process' hook gets to message the + # per-entry messages, but this hook is called with the full + # digest message before it is mailed. + # Example: digest-post-process = 'rss2email.post_process.downcase downcase_message' + ('digest-post-process', ''), ## HTML conversion # True: Send text/html messages when possible. # False: Convert HTML to plain text. @@ -155,14 +182,26 @@ CONFIG['DEFAULT'] = _collections.OrderedDict(( ('body-width', str(0)), ### Mailing + # Select protocol from: sendmail, smtp, imap + ('email-protocol', 'sendmail'), # True: Use SMTP_SERVER to send mail. - # False: Use sendmail (or compatible) to send mail. - ('use-smtp', str(False)), + # Sendmail (or compatible) configuration ('sendmail', '/usr/sbin/sendmail'), # Path to sendmail (or compatible) - ('smtp-server', 'smtp.yourisp.net:25'), ('smtp-auth', str(False)), # set to True to use SMTP AUTH + # SMTP configuration + ('smtp-auth', str(False)), # set to True to use SMTP AUTH ('smtp-username', 'username'), # username for SMTP AUTH ('smtp-password', 'password'), # password for SMTP AUTH + ('smtp-server', 'smtp.yourisp.net:25'), ('smtp-ssl', str(False)), # Connect to the SMTP server using SSL + ('smtp-ssl-protocol', 'SSLv3'), # TLS/SSL version to use on STARTTLS when not using 'smtp-ssl' + # IMAP configuration + ('imap-auth', str(False)), # set to True to use IMAP auth. + ('imap-username', 'username'), # username for IMAP authentication + ('imap-password', 'password'), # password for IMAP authentication + ('imap-server', 'imap.yourisp.net'), + ('imap-port', str(143)), + ('imap-ssl', str(False)), # connect to the IMAP server using SSL + ('imap-mailbox', 'INBOX'), # where we should store new messages ### Miscellaneous # Verbosity (one of 'error', 'warning', 'info', or 'debug').