Rename template_path to template

This commit is contained in:
Thor77 2016-11-18 21:46:38 +01:00
parent 4bed26dac8
commit 9a38e0e7cb
2 changed files with 3 additions and 3 deletions

View File

@ -94,7 +94,7 @@ def main(configuration):
render_template( render_template(
clients, clients,
output=abspath(configuration.get('General', 'output') + ext), output=abspath(configuration.get('General', 'output') + ext),
template_path=configuration.get('General', 'template'), template=configuration.get('General', 'template'),
datetime_fmt=configuration.get('General', 'datetimeformat'), datetime_fmt=configuration.get('General', 'datetimeformat'),
onlinetime_threshold=int(configuration.get( onlinetime_threshold=int(configuration.get(
'General', 'onlinetimethreshold')) 'General', 'onlinetimethreshold'))

View File

@ -13,7 +13,7 @@ logger = logging.getLogger('tsstats')
def render_template(clients, output, title='TeamspeakStats', def render_template(clients, output, title='TeamspeakStats',
template_path='template.html', datetime_fmt='%x %X %Z', template='template.html', datetime_fmt='%x %X %Z',
onlinetime_threshold=-1): onlinetime_threshold=-1):
''' '''
render template with `clients` render template with `clients`
@ -69,7 +69,7 @@ def render_template(clients, output, title='TeamspeakStats',
logger.debug('Formatting timestamp %s -> %s', timestamp, formatted) logger.debug('Formatting timestamp %s -> %s', timestamp, formatted)
return formatted return formatted
template_env.filters['frmttime'] = frmttime template_env.filters['frmttime'] = frmttime
template = template_env.get_template(template_path) template = template_env.get_template(template)
logger.debug('Rendering template %s', template) logger.debug('Rendering template %s', template)
with open(output, 'w', encoding='utf-8') as f: with open(output, 'w', encoding='utf-8') as f:
f.write(template.render(title=title, objs=objs, f.write(template.render(title=title, objs=objs,