Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 4FAD7429E47 for ; Wed, 14 Dec 2011 02:59:30 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jvh75MxL6G7m for ; Wed, 14 Dec 2011 02:59:28 -0800 (PST) Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 6B438429E4C for ; Wed, 14 Dec 2011 02:59:06 -0800 (PST) Received: from mail.jade-hamburg.de (unknown [85.183.11.228]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cryptobitch.de (Postfix) with ESMTPSA id 1165550F614 for ; Wed, 14 Dec 2011 11:59:05 +0100 (CET) Received: by mail.jade-hamburg.de (Postfix, from userid 401) id 8A389DF2A0; Wed, 14 Dec 2011 11:59:04 +0100 (CET) Received: from thinkbox.jade-hamburg.de (unknown [85.183.11.228]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: teythoon) by mail.jade-hamburg.de (Postfix) with ESMTPSA id 446BFDF2A6; Wed, 14 Dec 2011 11:58:48 +0100 (CET) Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.77) (envelope-from ) id 1RamXs-0004Mk-7d; Wed, 14 Dec 2011 11:58:44 +0100 From: Justus Winter <4winter@informatik.uni-hamburg.de> To: notmuch@notmuchmail.org Subject: [PATCH 7/7] python: add missing conversions from and to utf-8 Date: Wed, 14 Dec 2011 11:58:25 +0100 Message-Id: <1323860305-15802-8-git-send-email-4winter@informatik.uni-hamburg.de> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1323860305-15802-1-git-send-email-4winter@informatik.uni-hamburg.de> References: <1323860305-15802-1-git-send-email-4winter@informatik.uni-hamburg.de> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Dec 2011 10:59:31 -0000 --- bindings/python/notmuch/database.py | 6 +++--- bindings/python/notmuch/filename.py | 2 +- bindings/python/notmuch/message.py | 8 ++++---- bindings/python/notmuch/thread.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 3f6e04d..2eae69e 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -430,7 +430,7 @@ class Database(object): removed. """ 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): """Returns a :class:`Message` as identified by its message ID @@ -933,9 +933,9 @@ class Filenames(object): self._files_p = None raise StopIteration - file = Filenames._get(self._files_p) + file_ = Filenames._get(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 def __len__(self): diff --git a/bindings/python/notmuch/filename.py b/bindings/python/notmuch/filename.py index 969931a..0c2e0d5 100644 --- a/bindings/python/notmuch/filename.py +++ b/bindings/python/notmuch/filename.py @@ -93,7 +93,7 @@ class Filenames(Python3StringMixIn): raise NotmuchError(STATUS.NOT_INITIALIZED) 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._files = None diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/message.py index 955382d..245e814 100644 --- a/bindings/python/notmuch/message.py +++ b/bindings/python/notmuch/message.py @@ -338,7 +338,7 @@ class Message(Python3StringMixIn): """ if self._msg is None: 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): """Returns the thread ID @@ -356,7 +356,7 @@ class Message(Python3StringMixIn): if self._msg is None: 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): """Gets all direct replies to this message as :class:`Messages` @@ -426,7 +426,7 @@ class Message(Python3StringMixIn): raise NotmuchError(STATUS.NOT_INITIALIZED) #Returns NULL if any error occurs. - header = Message._get_header(self._msg, header) + header = Message._get_header(self._msg, _str(header)) if header == None: raise NotmuchError(STATUS.NULL_POINTER) return header.decode('UTF-8', errors='ignore') @@ -440,7 +440,7 @@ class Message(Python3StringMixIn): """ if self._msg is None: 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): """Get all filenames for the email corresponding to 'message' diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/thread.py index 3912957..2ed7db0 100644 --- a/bindings/python/notmuch/thread.py +++ b/bindings/python/notmuch/thread.py @@ -246,7 +246,7 @@ class Thread(object): """ if self._thread is None: 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.argtypes = [NotmuchThreadP] -- 1.7.7.3