3 """Per-user rss2email configuration
6 import collections as _collections
7 import configparser as _configparser
9 import html2text as _html2text
12 class Config (_configparser.ConfigParser):
13 def __init__(self, **kwargs):
14 super(Config, self).__init__(dict_type=_collections.OrderedDict)
16 def _setup(self, section='DEFAULT'):
17 _html2text.UNICODE_SNOB = self.getboolean(
18 section, 'unicode-snob', fallback=False)
19 _html2text.LINKS_EACH_PARAGRAPH = self.getboolean(
20 section, 'links-after-each-paragaph', fallback=False)
21 _html2text.BODY_WIDTH = self.getint(section, 'body-width', fallback=0)
26 # setup defaults for feeds that don't customize
27 CONFIG['DEFAULT'] = _collections.OrderedDict((
29 # The email address messages are from by default
30 ('from', 'bozo@dev.null.invalid'),
31 # True: Only use the 'from' address.
32 # False: Use the email address specified by the feed, when possible.
33 ('force-from', str(False)),
34 # True: Use the publisher's email if you can't find the author's.
35 # False: Just use the 'from' email instead.
36 ('use-publisher-email', str(False)),
37 # Only use the feed email address rather than friendly name
39 ('friendly-name', str(True)),
40 # Set this to default To email addresses.
44 # Set an HTTP proxy (e.g. 'http://your.proxy.here:8080/')
46 # Set the timeout (in seconds) for feed server response
47 ('feed-timeout', str(60)),
50 # True: Fetch, process, and email feeds.
51 # False: Don't fetch, process, or email feeds
52 ('active', str(True)),
53 # True: Generate Date header based on item's date, when possible.
54 # False: Generate Date header based on time sent.
55 ('date-header', str(False)),
56 # A comma-delimited list of some combination of
57 # ('issued', 'created', 'modified', 'expired')
58 # expressing ordered list of preference in dates
59 # to use for the Date header of the email.
60 ('date-header-order', 'modified, issued, created, expired'),
61 # Set this to add bonus headers to all emails
62 # Example: bonus-header = 'Approved: joe@bob.org'
64 # True: Receive one email per post.
65 # False: Receive an email every time a post changes.
66 ('trust-guid', str(True)),
67 # To most correctly encode emails with international
68 # characters, we iterate through the list below and use the
69 # first character set that works Eventually (and
70 # theoretically) UTF-8 is our catch-all failsafe.
71 ('encodings', 'US-ASCII, BIG5, ISO-2022-JP, ISO-8859-1, UTF-8'),
73 # True: Send text/html messages when possible.
74 # False: Convert HTML to plain text.
75 ('html-mail', str(False)),
76 # Optional CSS styling
77 ('use-css', str(False)),
80 ' font: 18pt Georgia, "Times New Roman";\n'
83 ' font: 12pt Arial;\n'
86 ' font: 12pt Arial;\n'
87 ' font-weight: bold;\n'
91 ' font-family: monospace;\n'
94 ' background: #e0ecff;\n'
95 ' border-bottom: solid 4px #c3d9ff;\n'
101 ' font-size: 20px;\n'
102 ' text-decoration: none;\n'
105 ' background: #c3d9ff;\n'
106 ' border-top: solid 4px #c3d9ff;\n'
108 ' margin-bottom: 0px;\n'
111 ' border: solid 4px #c3d9ff;\n'
114 ' margin-left: 5px;\n'
115 ' margin-right: 5px;\n'
118 # Use Unicode characters instead of their ascii psuedo-replacements
119 ('unicode-snob', str(False)),
120 # Put the links after each paragraph instead of at the end.
121 ('links-after-each-paragraph', str(False)),
122 # Wrap long lines at position. 0 for no wrapping.
123 ('body-width', str(0)),
126 # True: Use SMTP_SERVER to send mail.
127 # False: Call /usr/sbin/sendmail to send mail.
128 ('use-smtp', str(False)),
129 ('smtp-server', 'smtp.yourisp.net:25'), ('smtp-auth', str(False)), # set to True to use SMTP AUTH
130 ('smtp-username', 'username'), # username for SMTP AUTH
131 ('smtp-password', 'password'), # password for SMTP AUTH
132 ('smtp-ssl', str(False)), # Connect to the SMTP server using SSL
135 # Verbosity (one of 'error', 'warning', 'info', or 'debug').
136 ('verbose', 'warning'),