[PATCH v2 4/6] nmbug-status: Factor out header/footer context into a shared dict
authorW. Trevor King <wking@tremily.us>
Sat, 31 May 2014 22:20:25 +0000 (15:20 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:03:05 +0000 (10:03 -0800)
38/ac886c0ff510dd1112e40f094165f70c0406e1 [new file with mode: 0644]

diff --git a/38/ac886c0ff510dd1112e40f094165f70c0406e1 b/38/ac886c0ff510dd1112e40f094165f70c0406e1
new file mode 100644 (file)
index 0000000..3ad745b
--- /dev/null
@@ -0,0 +1,121 @@
+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 olra.theworths.org (Postfix) with ESMTP id 35474431E82\r
+       for <notmuch@notmuchmail.org>; Sat, 31 May 2014 15:21:11 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\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\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\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 dD-yu-7Wbs3s for <notmuch@notmuchmail.org>;\r
+       Sat, 31 May 2014 15:21:07 -0700 (PDT)\r
+Received: from qmta07.westchester.pa.mail.comcast.net\r
+       (qmta07.westchester.pa.mail.comcast.net [76.96.62.64])\r
+       by olra.theworths.org (Postfix) with ESMTP id 80BC8431FD4\r
+       for <notmuch@notmuchmail.org>; Sat, 31 May 2014 15:21:02 -0700 (PDT)\r
+Received: from omta05.westchester.pa.mail.comcast.net ([76.96.62.43])\r
+       by qmta07.westchester.pa.mail.comcast.net with comcast\r
+       id 8mJu1o0020vyq2s57mM1hQ; Sat, 31 May 2014 22:21:01 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+       by omta05.westchester.pa.mail.comcast.net with comcast\r
+       id 8mM01o00H152l3L3RmM1nX; Sat, 31 May 2014 22:21:01 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
+       by odin.tremily.us (Postfix) with ESMTPS id 4649611F0658;\r
+       Sat, 31 May 2014 15:21:00 -0700 (PDT)\r
+Received: (nullmailer pid 13194 invoked by uid 1000);\r
+       Sat, 31 May 2014 22:20:38 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 4/6] nmbug-status: Factor out header/footer context into a\r
+       shared dict\r
+Date: Sat, 31 May 2014 15:20:25 -0700\r
+Message-Id:\r
+ <967d2f99ba4e4b17c8e73b879b9205e64e562448.1401574293.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.9.1.353.gc66d89d\r
+In-Reply-To: <cover.1401574293.git.wking@tremily.us>\r
+References: <cover.1401574293.git.wking@tremily.us>\r
+In-Reply-To: <cover.1401574293.git.wking@tremily.us>\r
+References: <cover.1401574293.git.wking@tremily.us>\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+       s=q20140121; t=1401574861;\r
+       bh=I5xH/c/7rC3D3EAdxLDgPzSvqcTmF0hf26DqdE/Z2tM=;\r
+       h=Received:Received:Received:Received:From:To:Subject:Date:\r
+       Message-Id;\r
+       b=UIjmwfhZle3SoeTFX5Rfzlzosct7cNaYKUJUYpJONYmMcXdbkpMVHxpvlYwqyxnFu\r
+       vICvt/5R3kGNs52fL/KRVIGEsfddKw14Hyg5xEa9d+dmDwTdKL9zJ4et/qPbWETZBA\r
+       DNSPMd1pqogko3J09MhlCBxZk4qcjIWXxSGPwgkCs3D5W4NzhCPn8d3NSC5v8BfkPE\r
+       1Wnag7avVUd5IZ1ZuWyCTA5dTLRHWgJw8aAvubSsfTixV9JclgRmFFsR+7ODKpo4Y4\r
+       Q9q1B6BK2/PNOtGYWL1W+EBTxA1LDzs9vgXDc3sIhgAkEIic421/zKI1Ic2Ze8Wx9F\r
+       eYVOOs9rAeiZw==\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\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: Sat, 31 May 2014 22:21:11 -0000\r
+\r
+Rather than splitting this context into header-only and footer-only\r
+groups, just dump it all in a shared dict.  This will make it easier\r
+to eventually split the header/footer templates out of this script\r
+(e.g. if we want to load them from the config file).\r
+---\r
+ devel/nmbug/nmbug-status | 16 ++++++++++------\r
+ 1 file changed, 10 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status\r
+index c92d268..b7c2f80 100755\r
+--- a/devel/nmbug/nmbug-status\r
++++ b/devel/nmbug/nmbug-status\r
+@@ -275,6 +275,14 @@ parser.add_argument('--get-query', help='get query for view',\r
+ args = parser.parse_args()\r
\r
+ config = read_config(path=args.config)\r
++context = {\r
++    'date': datetime.datetime.utcnow(),\r
++    'title': config['meta']['title'],\r
++    'blurb': config['meta']['blurb'],\r
++    'encoding': _ENCODING,\r
++    'inter_message_padding': '0.25em',\r
++    'border_radius': '0.5em',\r
++    }\r
\r
+ _PAGES['text'] = Page()\r
+ _PAGES['html'] = HtmlPage(\r
+@@ -328,17 +336,13 @@ _PAGES['html'] = HtmlPage(\r
+ {blurb}\r
+ </p>\r
+ <h3>Views</h3>\r
+-'''.format(title=config['meta']['title'],\r
+-           blurb=config['meta']['blurb'],\r
+-           encoding=_ENCODING,\r
+-           inter_message_padding='0.25em',\r
+-           border_radius='0.5em'),\r
++'''.format(**context),\r
+     footer='''\r
+ <hr>\r
+ <p>Generated: {date}\r
+ </body>\r
+ </html>\r
+-'''.format(date=datetime.datetime.utcnow().date())\r
++'''.format(**context),\r
+     )\r
\r
+ if args.list_views:\r
+-- \r
+1.9.1.353.gc66d89d\r
+\r