]> git.notmuchmail.org Git - notmuch/commitdiff
python: str.decode() doesn't like kwargs in python 2.5
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Mon, 2 Jan 2012 16:07:53 +0000 (17:07 +0100)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Mon, 2 Jan 2012 16:07:53 +0000 (17:07 +0100)
Recent changes introduced lots of unicodification of strings, mostly in
the form of .decode('utf-8', errors='ignore'). However, python 2.5 does
not like the errors keyword argument and complains. It does work when
used as a simple arg though, so that's what this patch does.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
bindings/python/notmuch/database.py
bindings/python/notmuch/filename.py
bindings/python/notmuch/message.py
bindings/python/notmuch/thread.py

index 2eae69ed72ae6aebde5671a55df97500899b4161..24da8e99f1b715d43ffd8136e10ca4a7ed921b72 100644 (file)
@@ -935,7 +935,7 @@ class Filenames(object):
 
         file_ = Filenames._get(self._files_p)
         self._move_to_next(self._files_p)
-        return file_.decode('utf-8', errors='ignore')
+        return file_.decode('utf-8', 'ignore')
     next = __next__ # python2.x iterator protocol compatibility
 
     def __len__(self):
index 0c2e0d52b9d14f976a806dd3cd2ee63f71b98094..51dae202d5d656963a977739ae053ef55b35adb5 100644 (file)
@@ -93,7 +93,7 @@ class Filenames(Python3StringMixIn):
             raise NotmuchError(STATUS.NOT_INITIALIZED)
 
         while self._valid(self._files):
-            yield Filenames._get(self._files).decode('utf-8', errors='ignore')
+            yield Filenames._get(self._files).decode('utf-8', 'ignore')
             self._move_to_next(self._files)
 
         self._files = None
index fe724a51302498c3684351fe8fbde6023c4b64cb..d40a575d92d8587e355935abbb312117e2ec0a0c 100644 (file)
@@ -364,7 +364,7 @@ class Message(Python3StringMixIn):
         """
         if self._msg is None:
             raise NotmuchError(STATUS.NOT_INITIALIZED)
-        return Message._get_message_id(self._msg).decode('utf-8', errors='ignore')
+        return Message._get_message_id(self._msg).decode('utf-8', 'ignore')
 
     def get_thread_id(self):
         """Returns the thread ID
@@ -382,7 +382,7 @@ class Message(Python3StringMixIn):
         if self._msg is None:
             raise NotmuchError(STATUS.NOT_INITIALIZED)
 
-        return Message._get_thread_id(self._msg).decode('utf-8', errors='ignore')
+        return Message._get_thread_id(self._msg).decode('utf-8', 'ignore')
 
     def get_replies(self):
         """Gets all direct replies to this message as :class:`Messages`
@@ -454,7 +454,7 @@ class Message(Python3StringMixIn):
         header = Message._get_header(self._msg, _str(header))
         if header == None:
             raise NotmuchError(STATUS.NULL_POINTER)
-        return header.decode('UTF-8', errors='ignore')
+        return header.decode('UTF-8', 'ignore')
 
     def get_filename(self):
         """Returns the file path of the message file
@@ -465,7 +465,7 @@ class Message(Python3StringMixIn):
         """
         if self._msg is None:
             raise NotmuchError(STATUS.NOT_INITIALIZED)
-        return Message._get_filename(self._msg).decode('utf-8', errors='ignore')
+        return Message._get_filename(self._msg).decode('utf-8', 'ignore')
 
     def get_filenames(self):
         """Get all filenames for the email corresponding to 'message'
index 03e472ddc8984ae98abf8d92a077c37c5fe481db..e81ff1bdea305de55fada9a308508c4a5e6bd5d2 100644 (file)
@@ -246,7 +246,7 @@ class Thread(object):
         """
         if self._thread is None:
             raise NotmuchError(STATUS.NOT_INITIALIZED)
-        return Thread._get_thread_id(self._thread).decode('utf-8', errors='ignore')
+        return Thread._get_thread_id(self._thread).decode('utf-8', 'ignore')
 
     _get_total_messages = nmlib.notmuch_thread_get_total_messages
     _get_total_messages.argtypes = [NotmuchThreadP]
@@ -326,7 +326,7 @@ class Thread(object):
         authors = Thread._get_authors(self._thread)
         if authors is None:
             return None
-        return authors.decode('UTF-8', errors='ignore')
+        return authors.decode('UTF-8', 'ignore')
 
     def get_subject(self):
         """Returns the Subject of 'thread'
@@ -339,7 +339,7 @@ class Thread(object):
         subject = Thread._get_subject(self._thread)
         if subject is None:
             return None
-        return subject.decode('UTF-8', errors='ignore')
+        return subject.decode('UTF-8', 'ignore')
 
     def get_newest_date(self):
         """Returns time_t of the newest message date