aboutsummaryrefslogtreecommitdiffhomepage
path: root/bindings/python/notmuch/message.py
diff options
context:
space:
mode:
authorGravatar Patrick Totzke <patricktotzke@gmail.com>2011-12-05 22:51:10 +0000
committerGravatar Sebastian Spaeth <Sebastian@SSpaeth.de>2011-12-06 13:27:08 +0100
commitffe3097e58220d96c7a18b1b6062330551378b82 (patch)
tree4fb9453f0643c2520ad71f8ba35eb030ff351b8b /bindings/python/notmuch/message.py
parent2b0116119160f2dc8376a3570b23fd502328a521 (diff)
use __unicode__ for string representation
Diffstat (limited to 'bindings/python/notmuch/message.py')
-rw-r--r--bindings/python/notmuch/message.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/message.py
index 6ee5ec95..a9ded801 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -796,12 +796,14 @@ class Message(object):
return self.__str__()
def __str__(self):
- """A message() is represented by a 1-line summary"""
- msg = {}
- msg['from'] = self.get_header('from')
- msg['tags'] = self.get_tags()
- msg['date'] = date.fromtimestamp(self.get_date())
- return "%(from)s (%(date)s) (%(tags)s)" % (msg)
+ return unicode(self).encode('utf-8')
+
+ def __unicode__(self):
+ format = "%(from)s (%(date)s) (%(tags)s)"
+ return format % (self.get_header('from'),
+ self.get_tags(),
+ date.fromtimestamp(self.get_date()),
+ )
def get_message_parts(self):
"""Output like notmuch show"""