]> git.notmuchmail.org Git - notmuch/commitdiff
Simplify (& fix) Message().__str__()
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Thu, 16 Jun 2011 15:33:47 +0000 (17:33 +0200)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Thu, 16 Jun 2011 15:33:47 +0000 (17:33 +0200)
We were still using len(self.get_replies()) for the __str__ summary of a
mail, but 1) len(Messages()) has just gone away 2) the number of replies
can not be retrieved when we got the message via search_messages()
anyway, and 3) it is likely quite expensive to pull all replies for all
messages that we display a summary of.

So we fix this by simplifying str(Message()) to omit the number of replies.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
bindings/python/notmuch/message.py

index 706af476afac50ed1064442b709297c7d529777a..68de555248082efd58f0f7d8554652204c9124d6 100644 (file)
@@ -749,9 +749,7 @@ class Message(object):
         msg['from'] = self.get_header('from')
         msg['tags'] = str(self.get_tags())
         msg['date'] = date.fromtimestamp(self.get_date())
-        replies = self.get_replies()
-        msg['replies'] = len(replies) if replies is not None else 0
-        return "%(from)s (%(date)s) (%(tags)s) %(replies)d replies" % (msg)
+        return "%(from)s (%(date)s) (%(tags)s)" % (msg)
 
 
     def get_message_parts(self):