[PATCH v2 05/14] cli/reply: reorganize create_reply_message()
[notmuch-archives.git] / da / 9aad2c5f5bad414f78619209c1694868087786
1 Return-Path: <tomi.ollila@nixu.com>\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 75F85429E2F\r
6         for <notmuch@notmuchmail.org>; Wed, 14 Dec 2011 04:26:43 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 wGL8r4Hsx7yz for <notmuch@notmuchmail.org>;\r
16         Wed, 14 Dec 2011 04:26:42 -0800 (PST)\r
17 Received: from mail-gw3.nixu.fi (mail-gw3.nixu.fi [193.209.237.7])\r
18         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id A3094429E26\r
21         for <notmuch@notmuchmail.org>; Wed, 14 Dec 2011 04:26:42 -0800 (PST)\r
22 Received: from pps.filterd (mail-gw3 [127.0.0.1])\r
23         by mail-gw3.nixu.fi (8.14.4/8.14.4) with SMTP id pBECNMmQ009797;\r
24         Wed, 14 Dec 2011 14:26:39 +0200\r
25 Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
26         by mail-gw3.nixu.fi with ESMTP id 114cs0t9he-1\r
27         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
28         Wed, 14 Dec 2011 14:26:39 +0200\r
29 Received: from taco2.nixu.fi (taco2.nixu.fi [194.197.118.31])\r
30         by taco2.nixu.fi (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id\r
31         pBECQdc1016564; Wed, 14 Dec 2011 14:26:39 +0200\r
32 From: Tomi Ollila <tomi.ollila@iki.fi>\r
33 To: Justus Winter <4winter@informatik.uni-hamburg.de>, notmuch@notmuchmail.org\r
34 Subject: Re: [PATCH 6/7] py3k: Add and use a mixin class that implements\r
35         __str__\r
36 In-Reply-To:\r
37  <1323860305-15802-7-git-send-email-4winter@informatik.uni-hamburg.de>\r
38 References:\r
39  <1323860305-15802-1-git-send-email-4winter@informatik.uni-hamburg.de>\r
40         <1323860305-15802-7-git-send-email-4winter@informatik.uni-hamburg.de>\r
41 User-Agent: Notmuch/0.10.2+93~g631d290 (http://notmuchmail.org) Emacs/23.3.1\r
42         (i686-pc-linux-gnu)\r
43 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
44         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
45         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
46 Date: Wed, 14 Dec 2011 14:26:38 +0200\r
47 Message-ID: <yf6obvbs5j5.fsf@taco2.nixu.fi>\r
48 MIME-Version: 1.0\r
49 Content-Type: text/plain; charset=us-ascii\r
50 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.5.7110,\r
51  1.0.211,       0.0.0000        definitions=2011-12-14_05:2011-12-14, 2011-12-14,\r
52         1970-01-01 signatures=0\r
53 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0\r
54         ipscore=0 suspectscore=0\r
55         phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0\r
56         reason=mlx\r
57         scancount=1 engine=6.0.2-1012030000 definitions=main-1112140075\r
58 X-BeenThere: notmuch@notmuchmail.org\r
59 X-Mailman-Version: 2.1.13\r
60 Precedence: list\r
61 List-Id: "Use and development of the notmuch mail system."\r
62         <notmuch.notmuchmail.org>\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
66 List-Post: <mailto:notmuch@notmuchmail.org>\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
70 X-List-Received-Date: Wed, 14 Dec 2011 12:26:43 -0000\r
71 \r
72 On Wed, 14 Dec 2011 11:58:24 +0100, Justus Winter <4winter@informatik.uni-hamburg.de> wrote:\r
73 > ---\r
74 [ ... snip ... ]\r
75 \r
76 >  \r
77 > -class Filenames(object):\r
78 > +class Filenames(Python3StringMixIn):\r
79 >      """Represents a list of filenames as returned by notmuch\r
80 >  \r
81 >      This object contains the Filenames iterator. The main function is\r
82 > @@ -98,9 +98,6 @@ class Filenames(object):\r
83 >  \r
84 >          self._files = None\r
85 >  \r
86 > -    def __str__(self):\r
87 > -        return unicode(self).encode('utf-8')\r
88 > -\r
89 >      def __unicode__(self):\r
90 >          """Represent Filenames() as newline-separated list of full paths\r
91 >  \r
92 > diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py\r
93 > index c52790c..2111b86 100644\r
94 > --- a/bindings/python/notmuch/globals.py\r
95 > +++ b/bindings/python/notmuch/globals.py\r
96 > @@ -28,6 +28,16 @@ except:\r
97 >      raise ImportError("Could not find shared 'notmuch' library.")\r
98 >  \r
99 >  \r
100 > +if sys.version_info[0] == 2:\r
101 > +    class Python3StringMixIn(object):\r
102 > +        def __str__(self):\r
103 > +            return unicode(self).encode('utf-8')\r
104 > +else:\r
105 > +    class Python3StringMixIn(object):\r
106 > +        def __str__(self):\r
107 > +            return self.__unicode__()\r
108 > +\r
109 > +\r
110 \r
111 [ ... snip ... ]\r
112 \r
113 > -class Threads(object):\r
114 > +class Threads(Python3StringMixIn):\r
115 >      """Represents a list of notmuch threads\r
116 >  \r
117 >      This object provides an iterator over a list of notmuch threads\r
118 > @@ -393,7 +393,7 @@ class Thread(object):\r
119 >          return Tags(tags_p, self)\r
120 >  \r
121 >      def __str__(self):\r
122 > -        return unicode(self).encode('utf-8')\r
123 > +        return self.__unicode__().encode('utf-8')\r
124 >  \r
125 >      def __unicode__(self):\r
126 >          frm = "thread:%s %12s [%d/%d] %s; %s (%s)"\r
127 \r
128 Is this class special case ? in all other classes\r
129 the __str__() function has been removed (using inherited\r
130 function) ?\r
131 \r
132 > -- \r
133 > 1.7.7.3\r
134 \r
135 Otherwise LGTM -- pretty simple and effective (all 7 patches).\r
136 \r
137 Tomi\r
138 \r