aboutsummaryrefslogtreecommitdiffhomepage
path: root/devel
diff options
context:
space:
mode:
authorGravatar W. Trevor King <wking@tremily.us>2014-05-31 15:20:25 -0700
committerGravatar David Bremner <david@tethera.net>2014-07-15 20:08:24 -0300
commit783225846849b1f9c8f7ba3b54456278a2e46bc6 (patch)
treebc66d63ef4d3c72b7da813dd71d625c259246fef /devel
parentb70386a4cbeb1cd74ea4d54ee14f8bf22954e671 (diff)
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).
Diffstat (limited to 'devel')
-rwxr-xr-xdevel/nmbug/nmbug-status16
1 files 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}
</p>
<h3>Views</h3>
-'''.format(title=config['meta']['title'],
- blurb=config['meta']['blurb'],
- encoding=_ENCODING,
- inter_message_padding='0.25em',
- border_radius='0.5em'),
+'''.format(**context),
footer='''
<hr>
<p>Generated: {date}
</body>
</html>
-'''.format(date=datetime.datetime.utcnow().date())
+'''.format(**context),
)
if args.list_views: