mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-02-17 23:53:15 +01:00
python: add missing conversions from and to utf-8
This commit is contained in:
parent
4a6642a2a1
commit
83b256b12b
4 changed files with 9 additions and 9 deletions
|
@ -430,7 +430,7 @@ class Database(object):
|
||||||
removed.
|
removed.
|
||||||
"""
|
"""
|
||||||
self._assert_db_is_initialized()
|
self._assert_db_is_initialized()
|
||||||
return self._remove_message(self._db, filename)
|
return self._remove_message(self._db, _str(filename))
|
||||||
|
|
||||||
def find_message(self, msgid):
|
def find_message(self, msgid):
|
||||||
"""Returns a :class:`Message` as identified by its message ID
|
"""Returns a :class:`Message` as identified by its message ID
|
||||||
|
@ -933,9 +933,9 @@ class Filenames(object):
|
||||||
self._files_p = None
|
self._files_p = None
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
|
|
||||||
file = Filenames._get(self._files_p)
|
file_ = Filenames._get(self._files_p)
|
||||||
self._move_to_next(self._files_p)
|
self._move_to_next(self._files_p)
|
||||||
return file
|
return file_.decode('utf-8', errors='ignore')
|
||||||
next = __next__ # python2.x iterator protocol compatibility
|
next = __next__ # python2.x iterator protocol compatibility
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
|
|
|
@ -93,7 +93,7 @@ class Filenames(Python3StringMixIn):
|
||||||
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
||||||
|
|
||||||
while self._valid(self._files):
|
while self._valid(self._files):
|
||||||
yield Filenames._get(self._files)
|
yield Filenames._get(self._files).decode('utf-8', errors='ignore')
|
||||||
self._move_to_next(self._files)
|
self._move_to_next(self._files)
|
||||||
|
|
||||||
self._files = None
|
self._files = None
|
||||||
|
|
|
@ -338,7 +338,7 @@ class Message(Python3StringMixIn):
|
||||||
"""
|
"""
|
||||||
if self._msg is None:
|
if self._msg is None:
|
||||||
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
||||||
return Message._get_message_id(self._msg)
|
return Message._get_message_id(self._msg).decode('utf-8', errors='ignore')
|
||||||
|
|
||||||
def get_thread_id(self):
|
def get_thread_id(self):
|
||||||
"""Returns the thread ID
|
"""Returns the thread ID
|
||||||
|
@ -356,7 +356,7 @@ class Message(Python3StringMixIn):
|
||||||
if self._msg is None:
|
if self._msg is None:
|
||||||
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
||||||
|
|
||||||
return Message._get_thread_id(self._msg)
|
return Message._get_thread_id(self._msg).decode('utf-8', errors='ignore')
|
||||||
|
|
||||||
def get_replies(self):
|
def get_replies(self):
|
||||||
"""Gets all direct replies to this message as :class:`Messages`
|
"""Gets all direct replies to this message as :class:`Messages`
|
||||||
|
@ -426,7 +426,7 @@ class Message(Python3StringMixIn):
|
||||||
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
||||||
|
|
||||||
#Returns NULL if any error occurs.
|
#Returns NULL if any error occurs.
|
||||||
header = Message._get_header(self._msg, header)
|
header = Message._get_header(self._msg, _str(header))
|
||||||
if header == None:
|
if header == None:
|
||||||
raise NotmuchError(STATUS.NULL_POINTER)
|
raise NotmuchError(STATUS.NULL_POINTER)
|
||||||
return header.decode('UTF-8', errors='ignore')
|
return header.decode('UTF-8', errors='ignore')
|
||||||
|
@ -440,7 +440,7 @@ class Message(Python3StringMixIn):
|
||||||
"""
|
"""
|
||||||
if self._msg is None:
|
if self._msg is None:
|
||||||
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
||||||
return Message._get_filename(self._msg)
|
return Message._get_filename(self._msg).decode('utf-8', errors='ignore')
|
||||||
|
|
||||||
def get_filenames(self):
|
def get_filenames(self):
|
||||||
"""Get all filenames for the email corresponding to 'message'
|
"""Get all filenames for the email corresponding to 'message'
|
||||||
|
|
|
@ -246,7 +246,7 @@ class Thread(object):
|
||||||
"""
|
"""
|
||||||
if self._thread is None:
|
if self._thread is None:
|
||||||
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
raise NotmuchError(STATUS.NOT_INITIALIZED)
|
||||||
return Thread._get_thread_id(self._thread)
|
return Thread._get_thread_id(self._thread).decode('utf-8', errors='ignore')
|
||||||
|
|
||||||
_get_total_messages = nmlib.notmuch_thread_get_total_messages
|
_get_total_messages = nmlib.notmuch_thread_get_total_messages
|
||||||
_get_total_messages.argtypes = [NotmuchThreadP]
|
_get_total_messages.argtypes = [NotmuchThreadP]
|
||||||
|
|
Loading…
Add table
Reference in a new issue