summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-02-06 14:15:56 +0100
committerAnton Khirnov <anton@khirnov.net>2020-02-06 17:11:05 +0100
commitfbdde65a7f5eab74d2334481cee52ba429910c22 (patch)
tree736fcada5039b05a729f92695bf8c37c0a67872f /alot
parentaf713c2fad332f74c8b37d07e3c58bda979b2a4d (diff)
db/message: forbid instantiating Message with thread = None
It should always be instantiated from a Thread instance.
Diffstat (limited to 'alot')
-rw-r--r--alot/db/message.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/alot/db/message.py b/alot/db/message.py
index 8c3392e9..67a16e1e 100644
--- a/alot/db/message.py
+++ b/alot/db/message.py
@@ -25,14 +25,14 @@ class Message:
It it uses a :class:`~alot.db.DBManager` for cached manipulation
and lazy lookups.
"""
- def __init__(self, dbman, msg, thread=None):
+ def __init__(self, dbman, msg, thread):
"""
:param dbman: db manager that is used for further lookups
:type dbman: alot.db.DBManager
:param msg: the wrapped message
:type msg: notmuch.database.Message
- :param thread: this messages thread (will be looked up later if `None`)
- :type thread: :class:`~alot.db.Thread` or `None`
+ :param thread: this messages thread
+ :type thread: :class:`~alot.db.Thread`
"""
self._dbman = dbman
self._id = msg.get_message_id()
@@ -125,8 +125,6 @@ class Message:
def get_thread(self):
"""returns the :class:`~alot.db.Thread` this msg belongs to"""
- if not self._thread:
- self._thread = self._dbman.get_thread(self._thread_id)
return self._thread
def get_datestring(self):