summaryrefslogtreecommitdiff
path: root/alot/db/envelope.py
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2013-02-22 16:56:07 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2013-02-22 16:56:07 +0000
commitabecfea666e59aa9063615225797c16bd29ce721 (patch)
tree64e67e7c40dfb651d70b05521620da2413d72ff8 /alot/db/envelope.py
parent4717d3c4769a530b8176feb8d24165de34904e53 (diff)
docs: for Envelope
Diffstat (limited to 'alot/db/envelope.py')
-rw-r--r--alot/db/envelope.py24
1 files changed, 19 insertions, 5 deletions
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)