From d6851338bbcd15145d85ae92a5266db97fc01bb6 Mon Sep 17 00:00:00 2001
From: "W. Trevor King"
Date: Sat, 10 May 2014 12:54:57 -0700
Subject: [PATCH] nmbug-status: Factor out header/footer context into a shared
dict
Rather than splitting this context into header-only and footer-only
groups, just dump it all in a shared dict. This will make it easier
to eventually split the header/footer templates out of this script
(e.g. if we want to load them from the config file).
---
devel/nmbug/nmbug-status | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index c92d268c..b7c2f80e 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -275,6 +275,14 @@ parser.add_argument('--get-query', help='get query for view',
args = parser.parse_args()
config = read_config(path=args.config)
+context = {
+ 'date': datetime.datetime.utcnow(),
+ 'title': config['meta']['title'],
+ 'blurb': config['meta']['blurb'],
+ 'encoding': _ENCODING,
+ 'inter_message_padding': '0.25em',
+ 'border_radius': '0.5em',
+ }
_PAGES['text'] = Page()
_PAGES['html'] = HtmlPage(
@@ -328,17 +336,13 @@ _PAGES['html'] = HtmlPage(
{blurb}
Views
-'''.format(title=config['meta']['title'],
- blurb=config['meta']['blurb'],
- encoding=_ENCODING,
- inter_message_padding='0.25em',
- border_radius='0.5em'),
+'''.format(**context),
footer='''
Generated: {date}