_move_to_next.argtypes = [NotmuchMessagesP]
_move_to_next.restype = None
- def next(self):
+ def __next__(self):
if self._msgs is None:
raise NotmuchError(STATUS.NOT_INITIALIZED)
msg = Message(Messages._get(self._msgs), self)
self._move_to_next(self._msgs)
return msg
+ next = __next__ # python2.x iterator protocol compatibility
def __nonzero__(self):
"""
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
return unicode(self).encode('utf-8')
def __unicode__(self):
- format = "%(from)s (%(date)s) (%(tags)s)"
+ format = "%s (%s) (%s)"
return format % (self.get_header('from'),
self.get_tags(),
date.fromtimestamp(self.get_date()),