Re: [PATCH v2 2/4] nmbug-status: Add meta.message-url config setting
authorW. Trevor King <wking@tremily.us>
Wed, 23 Mar 2016 16:42:49 +0000 (09:42 +1700)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:21:22 +0000 (16:21 -0700)
8d/2c2a1c138caf9515449549d1639d33b71ee63f [new file with mode: 0644]

diff --git a/8d/2c2a1c138caf9515449549d1639d33b71ee63f b/8d/2c2a1c138caf9515449549d1639d33b71ee63f
new file mode 100644 (file)
index 0000000..b993b79
--- /dev/null
@@ -0,0 +1,188 @@
+Return-Path: <wking@tremily.us>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 6C0E06DE02A6\r
+ for <notmuch@notmuchmail.org>; Wed, 23 Mar 2016 09:51:11 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.811\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.811 tagged_above=-999 required=5 tests=[AWL=-0.704,\r
+  DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_BL=0.01, RCVD_IN_MSPIKE_L3=1.606,\r
+ SPF_PASS=-0.001] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id E1ydrqsWphv9 for <notmuch@notmuchmail.org>;\r
+ Wed, 23 Mar 2016 09:51:02 -0700 (PDT)\r
+X-Greylist: delayed 490 seconds by postgrey-1.35 at arlo;\r
+ Wed, 23 Mar 2016 09:51:02 PDT\r
+Received: from resqmta-po-11v.sys.comcast.net (resqmta-po-11v.sys.comcast.net\r
+ [96.114.154.170])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 983A46DE02A5\r
+ for <notmuch@notmuchmail.org>; Wed, 23 Mar 2016 09:51:02 -0700 (PDT)\r
+Received: from resomta-po-02v.sys.comcast.net ([96.114.154.226])\r
+ by resqmta-po-11v.sys.comcast.net with comcast\r
+ id ZUi71s0084tLnxL01UiqUg; Wed, 23 Mar 2016 16:42:50 +0000\r
+Received: from mail.tremily.us ([73.221.72.168])\r
+ by resomta-po-02v.sys.comcast.net with comcast\r
+ id ZUip1s00P3dr3C901Uiqs6; Wed, 23 Mar 2016 16:42:50 +0000\r
+Received: by mail.tremily.us (Postfix, from userid 1000)\r
+ id 52AB11C64427; Wed, 23 Mar 2016 09:42:49 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin;\r
+ t=1458751369; bh=zHdBDBknJzNt+DttTwj1XzIRpS5Vcux0iQHEP/SkkYY=;\r
+ h=Date:From:To:Cc:Subject:References:In-Reply-To;\r
+ b=anRQRiM3n4whau53/cq/AmxaiGu2zJoIhXIkdJ/6gwBpUEbtRuYl5mjzmZO5OEA9R\r
+ L/F+kJWJrt+b28JyfXhOj3awTJ2yeQnuwLTqYHG9/P9hYjG+V9f6Z1DpBTF81ckcqd\r
+ kG56u9nMv9uhHjn6rngWchF4/Qyy7K45jBOCe5Tc=\r
+Date: Wed, 23 Mar 2016 09:42:49 -0700\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: David Bremner <david@tethera.net>\r
+Cc: notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 2/4] nmbug-status: Add meta.message-url config setting\r
+Message-ID: <20160323164249.GX10674@odin.tremily.us>\r
+References: <cover.1451683912.git.wking@tremily.us>\r
+ <9377a4c1265b13f9588d21ec0ea591ea9f61a05f.1451683912.git.wking@tremily.us>\r
+ <87zitpjvax.fsf@zancas.localnet>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; micalg=pgp-sha1;\r
+ protocol="application/pgp-signature"; boundary="9/9WPmgm2v60RN0g"\r
+Content-Disposition: inline\r
+In-Reply-To: <87zitpjvax.fsf@zancas.localnet>\r
+OpenPGP: id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8;\r
+ url=http://tremily.us/pubkey.txt\r
+User-Agent: Mutt/1.5.23 (2014-03-12)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+ s=q20140121; t=1458751370;\r
+ bh=zmcCFXuSs8E8fqN/SiCc+DjWIQnZgAf0ytAfbfeiYPE=;\r
+ h=Received:Received:Received:Date:From:To:Subject:Message-ID:\r
+ MIME-Version:Content-Type;\r
+ b=OBzzC7oZelfJ7WMO1a7F/GUN/firdUYuZd6t4osyPWhrtWNPBkNmnzDMX6mzb9mX0\r
+ vQDzVovisnLsS9JDHat6MNyOqjFq+n7Vd5pnCjy6C1a7cty0gbwf/3XMdqHYztEczd\r
+ A5Qaj70bzlddFvIaliwnaBmbd7i2xDT3osxutzvMPyb3+yPHC6cGXgx+aVA5onv3mJ\r
+ oEOZndu42XHnTUBeaxC8BC3Clav4WfHfbVpgUJ9zM9UZhNMRjGUgwJ/FofTtPFileS\r
+ 5z37FfXqrr+93vGssYCniWxPS2oWCQtZMufgFxeLnXcCtPSu8AzkBFUYFB1FQMXFRg\r
+ mUKt8I0k2VdYg==\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 23 Mar 2016 16:51:11 -0000\r
+\r
+\r
+--9/9WPmgm2v60RN0g\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Wed, Mar 23, 2016 at 08:19:34AM -0300, David Bremner wrote:\r
+> W. Trevor King writes:\r
+> >  from __future__ import print_function\r
+> > @@ -232,6 +232,10 @@ class Page (object):\r
+> >  class HtmlPage (Page):\r
+> >      _slug_regexp =3D re.compile('\W+')\r
+> >\r
+> > +    def __init__(self, message_url_template, **kwargs):\r
+> > +        self.message_url_template =3D message_url_template\r
+> > +        super(HtmlPage, self).__init__(**kwargs)\r
+> > +\r
+>\r
+> > @@ -395,6 +400,8 @@ _PAGES['text'] =3D Page()\r
+> >  _PAGES['html'] =3D HtmlPage(\r
+> >      header=3Dheader_template.format(**context),\r
+> >      footer=3Dfooter_template.format(**context),\r
+> > +    message_url_template=3Dconfig['meta'].get(\r
+> > +        'message-url', 'http://mid.gmane.org/{message-id}'),\r
+> >      )\r
+> >\r
+>\r
+> Maybe I'm missing some python knowledged, but it looks the\r
+> constructor is defined to take a regular argument for\r
+> message_url_template, but only passed in as a keyword. Does this\r
+> really work?\r
+\r
+Yup.  From [1]:\r
+\r
+  positional-only: specifies an argument that can be supplied only by\r
+    position. Python has no syntax for defining positional-only\r
+    parameters. However, some built-in functions have positional-only\r
+    parameters (e.g. abs()).\r
+\r
+I can't find a similar Python 3 glossary, but see [2].  Whether we use:\r
+\r
+  def __init__(self, message_url_template, **kwargs):\r
+      =E2=80=A6\r
+\r
+or:\r
+\r
+  def __init__(self, message_url_template=3D'foobar', **kwargs):\r
+      =E2=80=A6\r
+\r
+just controls whether the message_url_template has a default or not,\r
+and not whether it can be set via positional or keyword arguments.\r
+\r
+There is Python syntax for keyword-only arguments, and it would look\r
+like [2]:\r
+\r
+  def __init__(self, *, message_url_template, **kwargs):\r
+      =E2=80=A6\r
+\r
+or:\r
+\r
+  def __init__(self, *, message_url_template=3D'foobar', **kwargs):\r
+      =E2=80=A6\r
+\r
+in the former case, you'd have to call __init__ with a\r
+message_url_template=3D=E2=80=A6 keyword argument or you'd get:\r
+\r
+  TypeError: __init__() missing 1 required keyword-only argument: 'message_=\r
+url_template'\r
+\r
+With the latter case, calling __init__ without a message_url_template\r
+argument would just get you the default value (=E2=80=98foobar=E2=80=99 in =\r
+these\r
+examples).\r
+\r
+Cheers,\r
+Trevor\r
+\r
+[1]: https://docs.python.org/2/glossary.html#term-parameter\r
+[2]: https://docs.python.org/3/reference/compound_stmts.html#function-defin=\r
+itions\r
+\r
+--=20\r
+This email may be signed or encrypted with GnuPG (http://www.gnupg.org).\r
+For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\r
+\r
+--9/9WPmgm2v60RN0g\r
+Content-Type: application/pgp-signature; name="signature.asc"\r
+Content-Description: OpenPGP digital signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v2\r
+\r
+iQIcBAEBAgAGBQJW8seHAAoJEAPqygegUbGs/eAQAJCBVzmrcY+PboKhJP5atwtT\r
+yq3WrENws2uvXLmB9+h7B7NJBRJk6xvefbpWWIsY003lqv0IVDt6c7a8L2JPPfgL\r
+VGr94elPkVCWNu74zYuRVxvHWURqo8167szslI40Fm7fB0d7V7lOFk8soaBEa4lV\r
+jOS6y2zkTubk7o0u92DdmtyiBnOTylbCym8ZhZ7S8sBysoWqr5I7Rh1YXRh7jvfP\r
+/GUIE6ZgbLNCWKA99Z4YMCX1glMLrLedU2SLQM+X2x6IsuIHVMVD8oj6FCj5A2VH\r
+CSjeWNMsMqIaEUinuM5BxKL7Z+N6+W8AuGpd2AQbhEpxGnXUb40JuwRc+F/tDn09\r
+T+oMdSj7x66Ik2bl3Ns0U/YMTOqSl7wL7kzufsm6X7sR6sA75fehSIkFo39hXziQ\r
+rp6lSjZLSgX/seiUs5icXy0G6acKaIT3DEalouA+HdNbc2Tyolp6U+wGX2JJO2/O\r
+WGudLN2bFtUc26VivkKf7FV/QS9XWP6X+VSZ2flWZSpeZQkVIGIca4QSsEcqS3dm\r
+p3eDHi9vdRYGWvsP3HA7YryI+NiIU0FHEIz329M8L9oqpEjB7TzPJsb+iUHcK1q0\r
+Vez4CVXLUEEbumgy4IhPOo7e1cUQh/OEDImr7PrP4naMAreRoFtvVWHywFWziQu3\r
+YDJ/hV9Y1qlxhKb2JIFW\r
+=o4kq\r
+-----END PGP SIGNATURE-----\r
+\r
+--9/9WPmgm2v60RN0g--\r