X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=bindings%2Fpython%2Fnotmuch%2Fmessage.py;h=ce8e7181b2743f162843c8f2d387baf3515d3f9c;hb=ff58a06e83379f2b224861082b782bec538f0d2d;hp=6ee5ec95e0bae524ba54f453f87335dad64da5eb;hpb=ecf8da35e26a899286797a65ce1e36f9600af250;p=notmuch diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/message.py index 6ee5ec95..ce8e7181 100644 --- a/bindings/python/notmuch/message.py +++ b/bindings/python/notmuch/message.py @@ -427,7 +427,7 @@ class Message(object): header = Message._get_header(self._msg, header) if header == None: raise NotmuchError(STATUS.NULL_POINTER) - return header.decode('UTF-8') + return header.decode('UTF-8', errors='ignore') def get_filename(self): """Returns the file path of the message file @@ -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 = "%s (%s) (%s)" + return format % (self.get_header('from'), + self.get_tags(), + date.fromtimestamp(self.get_date()), + ) def get_message_parts(self): """Output like notmuch show"""