From abecfea666e59aa9063615225797c16bd29ce721 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Fri, 22 Feb 2013 16:56:07 +0000 Subject: docs: for Envelope --- alot/db/envelope.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'alot/db/envelope.py') diff --git a/alot/db/envelope.py b/alot/db/envelope.py index 2e8f0366..4db8f67b 100644 --- a/alot/db/envelope.py +++ b/alot/db/envelope.py @@ -25,7 +25,24 @@ from utils import encode_header class Envelope(object): - """a message that is not yet sent and still editable""" + """a message that is not yet sent and still editable. + It holds references to unencoded! body text and mail headers among other things. + Envelope implements the python container API for easy access of header values. + So `e['To']`, `e['To'] = 'foo@bar.baz'` and 'e.get_all('To')' would work for + an envelope `e`.. + """ + + headers = {} + """dict containing the mail headers (a list of strings for each header key)""" + body = None + """mail body as unicode string""" + tmpfile = None + """template text for initial content""" + attachments = None + """list of :class:`~alot.db.attachment.Attachment`s""" + tags = [] + """tags # tags to add after successful sendout""" + def __init__(self, template=None, bodytext=u'', headers={}, attachments=[], sign=False, sign_key=None, encrypt=False, tags=[]): """ @@ -36,16 +53,13 @@ class Envelope(object): :param bodytext: text used as body part :type bodytext: str :param headers: unencoded header values - :type headers: dict (str -> unicode) + :type headers: dict (str -> [unicode]) :param attachments: file attachments to include :type attachments: list of :class:`~alot.db.attachment.Attachment` :param tags: tags to add after successful sendout and saving this message :type tags: list of str """ assert isinstance(bodytext, unicode) - self.headers = {} - self.body = None - self.tmpfile = None logging.debug('TEMPLATE: %s' % template) if template: self.parse_template(template) -- cgit v1.2.3