unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [Patch] tag.py: Bugfix to avoid decode() on a NoneType object
@ 2011-07-22 14:11 Michael Heinrich
  2011-07-22 19:13 ` Patrick Totzke
  2011-08-12  8:14 ` Sebastian Spaeth
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Heinrich @ 2011-07-22 14:11 UTC (permalink / raw)
  To: notmuch

Dear all,

with current head I get following error in my python scripts when I read the
tags of a message:

  File "/home/heinrich/.local/lib/python2.6/site-packages/notmuch/tag.py", line
88, in next
    tag = Tags._get(self._tags).decode('utf-8')


Here is a patch:

diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py
index 65a9118..e9049fc 100644
--- a/bindings/python/notmuch/tag.py
+++ b/bindings/python/notmuch/tag.py
@@ -85,10 +85,12 @@ class Tags(object):
             raise NotmuchError(STATUS.NOT_INITIALIZED)
         # No need to call nmlib.notmuch_tags_valid(self._tags);
         # Tags._get safely returns None, if there is no more valid tag.
-        tag = Tags._get(self._tags).decode('utf-8')
+        tag = Tags._get(self._tags)
         if tag is None:
             self._tags = None
             raise StopIteration
+        else:
+            tag = tag.decode('utf-8')
         nmlib.notmuch_tags_move_to_next(self._tags)
         return tag
 

Michael.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-17 12:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-22 14:11 [Patch] tag.py: Bugfix to avoid decode() on a NoneType object Michael Heinrich
2011-07-22 19:13 ` Patrick Totzke
2011-08-12  8:14 ` Sebastian Spaeth
2011-08-12 13:23   ` [PATCH] [python] decode headers from utf-8 to unicode Patrick Totzke
2011-08-15 13:49     ` Sebastian Spaeth
2011-08-16 21:37     ` [PATCH 2/2] [python] fix unsafe utf-8 decodings Patrick Totzke
2011-08-17 12:48       ` Sebastian Spaeth

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).