From 1ecf24b9b28327f53cc46dc0c7eaf6dc357bd75e Mon Sep 17 00:00:00 2001 From: Thor77 Date: Sat, 17 Sep 2016 22:38:30 +0200 Subject: [PATCH] Add datetime_fmt-arg to tsstats.template.render_template Specify a custom datetime-format for various datetime-renderings (creation-time, last online) --- tsstats/template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsstats/template.py b/tsstats/template.py index 74edf45..d6736f7 100644 --- a/tsstats/template.py +++ b/tsstats/template.py @@ -12,7 +12,7 @@ logger = logging.getLogger('tsstats') def render_template(clients, output, title='TeamspeakStats', - template_path='template.html'): + template_path='template.html', datetime_fmt='%x %X %Z'): ''' render template with `clients` @@ -55,7 +55,7 @@ def render_template(clients, output, title='TeamspeakStats', def frmttime(timestamp): if not timestamp: return '' - return timestamp.strftime('%x %X %Z') + return timestamp.strftime(datetime_fmt) template_env.filters['frmttime'] = frmttime template = template_env.get_template(template_path) with open(output, 'w') as f: