From bbd2ff7a4639f66dffb8a6cd1a12c2e30001f353 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Wed, 10 Aug 2016 22:47:19 +0200 Subject: [PATCH] Add template_path-kwarg to tsstats.template.render_template --- tsstats/template.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tsstats/template.py b/tsstats/template.py index 67277c3..74edf45 100644 --- a/tsstats/template.py +++ b/tsstats/template.py @@ -11,7 +11,8 @@ from tsstats.utils import seconds_to_text, sort_clients logger = logging.getLogger('tsstats') -def render_template(clients, output, title='TeamspeakStats'): +def render_template(clients, output, title='TeamspeakStats', + template_path='template.html'): ''' render template with `clients` @@ -19,11 +20,13 @@ def render_template(clients, output, title='TeamspeakStats'): :param output: path to output-file :param template_name: path to template-file :param title: title of the resulting html-document + :param template_path: path to template-file :type clients: tsstats.client.Clients :type output: str :type template_name: str :type title: str + :type template_path: str ''' # prepare clients clients_onlinetime_ = sort_clients( @@ -54,7 +57,7 @@ def render_template(clients, output, title='TeamspeakStats'): return '' return timestamp.strftime('%x %X %Z') template_env.filters['frmttime'] = frmttime - template = template_env.get_template('template.html') + template = template_env.get_template(template_path) with open(output, 'w') as f: f.write(template.render(title=title, objs=objs, debug=logger.level <= logging.DEBUG,