From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 14929431FB6 for ; Tue, 12 Jul 2011 14:30:08 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 Cldz1A7fWmhL for ; Tue, 12 Jul 2011 14:30:06 -0700 (PDT) Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E4E7C431FD0 for ; Tue, 12 Jul 2011 14:30:05 -0700 (PDT) Received: by wyh22 with SMTP id 22so3984681wyh.26 for ; Tue, 12 Jul 2011 14:30:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=4hWKUqbLo+D8M0Nn1j/r89R3Qp5VcepvAsxOXpr1wyY=; b=Akwr2QMTTqxAa4DfDVs2jgHB4k9b7MLn+r7z3GqY86wdAs8MjWrtYU9YKiAMvMwlza Nd7v4HyBJxONHuo3NhIXBOwmNR0/i/1sw0TLTlzN5sVMwyC9X5cItGuXsjRa7Ij+i7aE 4J+r/j4C/EM2uVfzFfz8Ko9Au3WAb0FY45WF8= Received: by 10.227.2.199 with SMTP id 7mr325973wbk.88.1310506204501; Tue, 12 Jul 2011 14:30:04 -0700 (PDT) Received: from brick.lan (cpc1-sgyl2-0-0-cust47.sgyl.cable.virginmedia.com [80.192.18.48]) by mx.google.com with ESMTPS id o19sm6783301wbh.43.2011.07.12.14.30.01 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Jul 2011 14:30:02 -0700 (PDT) Date: Tue, 12 Jul 2011 22:29:58 +0100 From: Patrick Totzke To: Sebastian Spaeth Subject: Re: Encodings Message-ID: <20110712212958.GA17348@brick.lan> References: <87zkkkx6am.fsf@SSpaeth.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gBBFr7Ir9EOA20Yy" Content-Disposition: inline In-Reply-To: <87zkkkx6am.fsf@SSpaeth.de> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Notmuch developer list 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: Tue, 12 Jul 2011 21:30:08 -0000 --gBBFr7Ir9EOA20Yy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hiya, I noticed that commit 687366b920caa5de6ea0b66b70cf2a11e5399f7b breaks things with Database.get_all_tags: -------------------------------------->%-----------------------------------= -- AttributeError Traceback (most recent call last) /home/pazz/projects/alot/ in () /usr/local/lib/python2.7/dist-packages/notmuch/tag.pyc in next(self) 86 # No need to call nmlib.notmuch_tags_valid(self._tags); 87 # Tags._get safely returns None, if there is no more valid = tag. ---> 88 tag =3D Tags._get(self._tags).decode('utf-8') 89 if tag is None: 90 self._tags =3D None AttributeError: 'NoneType' object has no attribute 'decode' ------------------------------------%<-------------------------------------= -- The reason is that the Tags.next() tries to decode before it tests if tag i= s None. Now, we _could_ apply a patch like this one here: ---------------------------------->%---------------------------------------= -- diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py index 65a9118..2ae670d 100644 --- a/bindings/python/notmuch/tag.py +++ b/bindings/python/notmuch/tag.py @@ -85,12 +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 =3D Tags._get(self._tags).decode('utf-8') + tag =3D Tags._get(self._tags) if tag is None: self._tags =3D None raise StopIteration nmlib.notmuch_tags_move_to_next(self._tags) - return tag + return tag.decode('utf-8') =20 def __nonzero__(self): """Implement bool(Tags) check that can be repeatedly used -------------------------------------------%<----------------------------- But as Carl sais, we cannot guarantee that a tag is utf8 encoded anyway. So i'd suggest we just revore the commit in question. best, /p --gBBFr7Ir9EOA20Yy Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk4cvNYACgkQlDQDZ9fWxargfwCfWPyH3bte8jnFcqpmxzq5IIHY eWQAnAvPZub91ujDTsgaDI1NgFwezfec =w/5u -----END PGP SIGNATURE----- --gBBFr7Ir9EOA20Yy--