[PATCH v2 4/6] nmbug-status: Factor out header/footer context into a shared dict
[notmuch-archives.git] / 38 / ac886c0ff510dd1112e40f094165f70c0406e1
1 Return-Path: <wking@tremily.us>\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 35474431E82\r
6         for <notmuch@notmuchmail.org>; Sat, 31 May 2014 15:21:11 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: 0\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
13         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\r
14         autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id dD-yu-7Wbs3s for <notmuch@notmuchmail.org>;\r
18         Sat, 31 May 2014 15:21:07 -0700 (PDT)\r
19 Received: from qmta07.westchester.pa.mail.comcast.net\r
20         (qmta07.westchester.pa.mail.comcast.net [76.96.62.64])\r
21         by olra.theworths.org (Postfix) with ESMTP id 80BC8431FD4\r
22         for <notmuch@notmuchmail.org>; Sat, 31 May 2014 15:21:02 -0700 (PDT)\r
23 Received: from omta05.westchester.pa.mail.comcast.net ([76.96.62.43])\r
24         by qmta07.westchester.pa.mail.comcast.net with comcast\r
25         id 8mJu1o0020vyq2s57mM1hQ; Sat, 31 May 2014 22:21:01 +0000\r
26 Received: from odin.tremily.us ([24.18.63.50])\r
27         by omta05.westchester.pa.mail.comcast.net with comcast\r
28         id 8mM01o00H152l3L3RmM1nX; Sat, 31 May 2014 22:21:01 +0000\r
29 Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
30         by odin.tremily.us (Postfix) with ESMTPS id 4649611F0658;\r
31         Sat, 31 May 2014 15:21:00 -0700 (PDT)\r
32 Received: (nullmailer pid 13194 invoked by uid 1000);\r
33         Sat, 31 May 2014 22:20:38 -0000\r
34 From: "W. Trevor King" <wking@tremily.us>\r
35 To: notmuch@notmuchmail.org\r
36 Subject: [PATCH v2 4/6] nmbug-status: Factor out header/footer context into a\r
37         shared dict\r
38 Date: Sat, 31 May 2014 15:20:25 -0700\r
39 Message-Id:\r
40  <967d2f99ba4e4b17c8e73b879b9205e64e562448.1401574293.git.wking@tremily.us>\r
41 X-Mailer: git-send-email 1.9.1.353.gc66d89d\r
42 In-Reply-To: <cover.1401574293.git.wking@tremily.us>\r
43 References: <cover.1401574293.git.wking@tremily.us>\r
44 In-Reply-To: <cover.1401574293.git.wking@tremily.us>\r
45 References: <cover.1401574293.git.wking@tremily.us>\r
46 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
47         s=q20140121; t=1401574861;\r
48         bh=I5xH/c/7rC3D3EAdxLDgPzSvqcTmF0hf26DqdE/Z2tM=;\r
49         h=Received:Received:Received:Received:From:To:Subject:Date:\r
50         Message-Id;\r
51         b=UIjmwfhZle3SoeTFX5Rfzlzosct7cNaYKUJUYpJONYmMcXdbkpMVHxpvlYwqyxnFu\r
52         vICvt/5R3kGNs52fL/KRVIGEsfddKw14Hyg5xEa9d+dmDwTdKL9zJ4et/qPbWETZBA\r
53         DNSPMd1pqogko3J09MhlCBxZk4qcjIWXxSGPwgkCs3D5W4NzhCPn8d3NSC5v8BfkPE\r
54         1Wnag7avVUd5IZ1ZuWyCTA5dTLRHWgJw8aAvubSsfTixV9JclgRmFFsR+7ODKpo4Y4\r
55         Q9q1B6BK2/PNOtGYWL1W+EBTxA1LDzs9vgXDc3sIhgAkEIic421/zKI1Ic2Ze8Wx9F\r
56         eYVOOs9rAeiZw==\r
57 Cc: Tomi Ollila <tomi.ollila@iki.fi>\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: Sat, 31 May 2014 22:21:11 -0000\r
71 \r
72 Rather than splitting this context into header-only and footer-only\r
73 groups, just dump it all in a shared dict.  This will make it easier\r
74 to eventually split the header/footer templates out of this script\r
75 (e.g. if we want to load them from the config file).\r
76 ---\r
77  devel/nmbug/nmbug-status | 16 ++++++++++------\r
78  1 file changed, 10 insertions(+), 6 deletions(-)\r
79 \r
80 diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status\r
81 index c92d268..b7c2f80 100755\r
82 --- a/devel/nmbug/nmbug-status\r
83 +++ b/devel/nmbug/nmbug-status\r
84 @@ -275,6 +275,14 @@ parser.add_argument('--get-query', help='get query for view',\r
85  args = parser.parse_args()\r
86  \r
87  config = read_config(path=args.config)\r
88 +context = {\r
89 +    'date': datetime.datetime.utcnow(),\r
90 +    'title': config['meta']['title'],\r
91 +    'blurb': config['meta']['blurb'],\r
92 +    'encoding': _ENCODING,\r
93 +    'inter_message_padding': '0.25em',\r
94 +    'border_radius': '0.5em',\r
95 +    }\r
96  \r
97  _PAGES['text'] = Page()\r
98  _PAGES['html'] = HtmlPage(\r
99 @@ -328,17 +336,13 @@ _PAGES['html'] = HtmlPage(\r
100  {blurb}\r
101  </p>\r
102  <h3>Views</h3>\r
103 -'''.format(title=config['meta']['title'],\r
104 -           blurb=config['meta']['blurb'],\r
105 -           encoding=_ENCODING,\r
106 -           inter_message_padding='0.25em',\r
107 -           border_radius='0.5em'),\r
108 +'''.format(**context),\r
109      footer='''\r
110  <hr>\r
111  <p>Generated: {date}\r
112  </body>\r
113  </html>\r
114 -'''.format(date=datetime.datetime.utcnow().date())\r
115 +'''.format(**context),\r
116      )\r
117  \r
118  if args.list_views:\r
119 -- \r
120 1.9.1.353.gc66d89d\r
121 \r