Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general refactoring
authorTomi Ollila <tomi.ollila@iki.fi>
Mon, 3 Feb 2014 21:10:23 +0000 (23:10 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:59:41 +0000 (09:59 -0800)
4d/1610adf8532b6faa7aff965896e404b5675d89 [new file with mode: 0644]

diff --git a/4d/1610adf8532b6faa7aff965896e404b5675d89 b/4d/1610adf8532b6faa7aff965896e404b5675d89
new file mode 100644 (file)
index 0000000..dca1ce3
--- /dev/null
@@ -0,0 +1,148 @@
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1621B431FBC\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Feb 2014 13:10:37 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id I+BqKRVaaZhb for <notmuch@notmuchmail.org>;\r
+       Mon,  3 Feb 2014 13:10:29 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 7C2B2431FAF\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Feb 2014 13:10:29 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+       by guru.guru-group.fi (Postfix) with ESMTP id 573E4100033;\r
+       Mon,  3 Feb 2014 23:10:23 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: "W. Trevor King" <wking@tremily.us>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 00/17] nmbug-status: Python-3-compabitility and general\r
+       refactoring\r
+In-Reply-To: <cover.1391424512.git.wking@tremily.us>\r
+References: <cover.1391424512.git.wking@tremily.us>\r
+User-Agent: Notmuch/0.17+55~g4397960 (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Mon, 03 Feb 2014 23:10:23 +0200\r
+Message-ID: <m2ha8frjgg.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 03 Feb 2014 21:10:37 -0000\r
+\r
+On Mon, Feb 03 2014, "W. Trevor King" <wking@tremily.us> wrote:\r
+\r
+> I noticed that nmbug-status was written in Python :), but not\r
+> compatible with Python 3 :(.  I started cleaning up a few print\r
+> statements, but this quickly turned into a more general refactoring.\r
+> Let me know if this is too much to bite off at once.  I tried to keep\r
+> each patch fairly contained, but the Page / HtmlPage addition is still\r
+> pretty big.  Despite increasing the size of this module by almost 50%,\r
+> I think my final version is more readable.  However, it's always\r
+> easier to read your own code, so feel free to tell me that this is a\r
+> step in the completely wrong direction ;).\r
+>\r
+> Also anyone with asthetic sensibilities is free to pick nicer colors\r
+> in the final patch.  I'm too partial to the EFF permutation symmetry\r
+> to be able to pick other colors myself ;).\r
+\r
+Nice series. One problem with python 2.6 though:\r
+\r
+Traceback (most recent call last):\r
+  File "devel/nmbug/nmbug-status", line 300, in <module>\r
+    page.write(database=db, views=config['views'])\r
+  File "devel/nmbug/nmbug-status", line 76, in write\r
+    self._write_view(database=database, view=view, stream=stream)\r
+  File "devel/nmbug/nmbug-status", line 93, in _write_view\r
+    threads = self._get_threads(messages=q.search_messages())\r
+  File "devel/nmbug/nmbug-status", line 107, in _get_threads\r
+    running_data=thread.running_data, message=message)\r
+  File "devel/nmbug/nmbug-status", line 207, in _message_display_data\r
+    *args, **kwargs)\r
+  File "devel/nmbug/nmbug-status", line 132, in _message_display_data\r
+    data['message-id-term'] = 'id:"{}"'.format(value)\r
+ValueError: zero length field name in format\r
+\r
+Using python 2.6.6\r
+\r
+$ python -c 'print "{}".format("foo")'\r
+Traceback (most recent call last):\r
+  File "<string>", line 1, in <module>\r
+ValueError: zero length field name in format\r
+zsh: exit 1     python -c '"{}".format("foo")'\r
+\r
+python -c 'print "{0}".format("foo")'\r
+foo\r
+\r
+With python 2.7.x python -c 'print "{}".format("foo")' works OK.\r
+\r
+Argh, when I changed that one, next:\r
+\r
+Traceback (most recent call last):\r
+  File "devel/nmbug/nmbug-status", line 300, in <module>\r
+    page.write(database=db, views=config['views'])\r
+  File "devel/nmbug/nmbug-status", line 76, in write\r
+    self._write_view(database=database, view=view, stream=stream)\r
+  File "devel/nmbug/nmbug-status", line 95, in _write_view\r
+    self._write_threads(threads=threads, stream=stream)\r
+  File "devel/nmbug/nmbug-status", line 197, in _write_threads\r
+    ).format(**message_display_data))\r
+  File "/usr/lib64/python2.6/codecs.py", line 351, in write\r
+    data, consumed = self.encode(object, self.errors)\r
+UnicodeEncodeError: 'ascii' codec can't encode character u'\u017b' in\r
+  position 176: ordinal not in range(128)\r
+\r
+This one is harder...\r
+\r
+Tomi\r
+\r
+\r
+>\r
+> W. Trevor King (17):\r
+>   nmbug-status: Convert to Python-3-compatible print functions\r
+>   nmbug-status: Use email.utils instead of rfc822\r
+>   nmbug-status: Decode Popen output using the user's locale\r
+>   nmbug-status: Factor config-loading out into read_config\r
+>   nmbug-status: Add metavars for --config and --get-query\r
+>   nmbug-status: Consolidate functions and main code\r
+>   nmbug-status: Don't require write access\r
+>   nmbug-status: Consolidate HTML header printing\r
+>   nmbug-status: Add a Python-3-compatible urllib.parse.quote import\r
+>   nmbug-status: Add Page and HtmlPage for modular rendering\r
+>   nmbug-status: Normalize table HTML indentation\r
+>   nmbug-status: Convert from XHTML 1.0 to HTML 5\r
+>   nmbug-status: Encode output using the user's locale\r
+>   nmbug-status: Anchor with h3 ids instead of a names\r
+>   nmbug-status: Quote the title when using it as an id\r
+>   nmbug-status: Use <code> and <p> markup where appropriate\r
+>   nmbug-status: Color threads in HTML output\r
+>\r
+>  devel/nmbug/nmbug-status | 412 ++++++++++++++++++++++++++++++-----------------\r
+>  1 file changed, 261 insertions(+), 151 deletions(-)\r
+>\r
+> -- \r
+> 1.8.5.2.8.g0f6c0d1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r