1 Return-Path: <teythoon@jade-hamburg.de>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id A5F5441434B
\r
6 for <notmuch@notmuchmail.org>; Sun, 8 Jan 2012 06:06:54 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.001 tagged_above=-999 required=5
\r
12 tests=[UNPARSEABLE_RELAY=0.001] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id XCMf3xwDtIIl for <notmuch@notmuchmail.org>;
\r
16 Sun, 8 Jan 2012 06:06:51 -0800 (PST)
\r
17 Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68])
\r
18 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 2F35A414343
\r
21 for <notmuch@notmuchmail.org>; Sun, 8 Jan 2012 06:06:51 -0800 (PST)
\r
22 Received: from mail.jade-hamburg.de (unknown [85.183.11.228])
\r
23 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
\r
24 (No client certificate requested)
\r
25 by mail.cryptobitch.de (Postfix) with ESMTPSA id A3768513C80
\r
26 for <notmuch@notmuchmail.org>; Sun, 8 Jan 2012 15:06:49 +0100 (CET)
\r
27 Received: by mail.jade-hamburg.de (Postfix, from userid 401)
\r
28 id EA9DADF2A2; Sun, 8 Jan 2012 15:06:48 +0100 (CET)
\r
29 Received: from thinkbox.jade-hamburg.de (unknown
\r
30 [IPv6:fe80::216:d3ff:fe3e:5058%br0])
\r
31 (using TLSv1 with cipher AES256-SHA (256/256 bits))
\r
32 (No client certificate requested) (Authenticated sender: teythoon)
\r
33 by mail.jade-hamburg.de (Postfix) with ESMTPSA id 7A5BBDF2A0;
\r
34 Sun, 8 Jan 2012 15:06:47 +0100 (CET)
\r
35 Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.77)
\r
36 (envelope-from <teythoon@thinkbox.jade-hamburg.de>)
\r
37 id 1RjtOY-0007wh-Ty; Sun, 08 Jan 2012 15:06:47 +0100
\r
38 From: Justus Winter <4winter@informatik.uni-hamburg.de>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH] py3k: the basestring and unicode types are removed in python
\r
42 Date: Sun, 8 Jan 2012 15:06:29 +0100
\r
44 <1326031589-30506-1-git-send-email-4winter@informatik.uni-hamburg.de>
\r
45 X-Mailer: git-send-email 1.7.7.3
\r
46 In-Reply-To: <20120108140444.26863.68188@thinkbox.jade-hamburg.de>
\r
47 References: <20120108140444.26863.68188@thinkbox.jade-hamburg.de>
\r
48 X-BeenThere: notmuch@notmuchmail.org
\r
49 X-Mailman-Version: 2.1.13
\r
51 List-Id: "Use and development of the notmuch mail system."
\r
52 <notmuch.notmuchmail.org>
\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
56 List-Post: <mailto:notmuch@notmuchmail.org>
\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
60 X-List-Received-Date: Sun, 08 Jan 2012 14:06:54 -0000
\r
63 bindings/python/notmuch/globals.py | 34 ++++++++++++++++++++++------------
\r
64 1 files changed, 22 insertions(+), 12 deletions(-)
\r
66 diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py
\r
67 index 32ed9ae..4138460 100644
\r
68 --- a/bindings/python/notmuch/globals.py
\r
69 +++ b/bindings/python/notmuch/globals.py
\r
70 @@ -31,12 +31,34 @@ if sys.version_info[0] == 2:
\r
71 class Python3StringMixIn(object):
\r
73 return unicode(self).encode('utf-8')
\r
77 + """Ensure a nicely utf-8 encoded string to pass to libnotmuch
\r
79 + C++ code expects strings to be well formatted and
\r
80 + unicode strings to have no null bytes."""
\r
81 + if not isinstance(value, basestring):
\r
82 + raise TypeError("Expected str or unicode, got %s" % type(value))
\r
83 + if isinstance(value, unicode):
\r
84 + return value.encode('UTF-8')
\r
87 class Python3StringMixIn(object):
\r
89 return self.__unicode__()
\r
93 + """Ensure a nicely utf-8 encoded string to pass to libnotmuch
\r
95 + C++ code expects strings to be well formatted and
\r
96 + unicode strings to have no null bytes."""
\r
97 + if not isinstance(value, str):
\r
98 + raise TypeError("Expected str, got %s" % type(value))
\r
99 + return value.encode('UTF-8')
\r
102 class Enum(object):
\r
103 """Provides ENUMS as "code=Enum(['a','b','c'])" where code.a=0 etc..."""
\r
104 def __init__(self, names):
\r
105 @@ -202,18 +224,6 @@ class NotInitializedError(NotmuchError):
\r
106 status = STATUS.NOT_INITIALIZED
\r
110 - """Ensure a nicely utf-8 encoded string to pass to libnotmuch
\r
112 - C++ code expects strings to be well formatted and
\r
113 - unicode strings to have no null bytes."""
\r
114 - if not isinstance(value, basestring):
\r
115 - raise TypeError("Expected str or unicode, got %s" % str(type(value)))
\r
116 - if isinstance(value, unicode):
\r
117 - return value.encode('UTF-8')
\r
121 class NotmuchDatabaseS(Structure):
\r
123 NotmuchDatabaseP = POINTER(NotmuchDatabaseS)
\r