template-filter frmttime just returns formatted timestamp now

* instead of converting it to localtime before
This commit is contained in:
Thor77 2016-06-12 18:01:47 +02:00
parent 2ed3b7f48d
commit e3df7f8185
1 changed files with 3 additions and 2 deletions

View File

@ -2,7 +2,6 @@
import logging
from os.path import dirname
from time import localtime, strftime
from jinja2 import ChoiceLoader, Environment, FileSystemLoader, PackageLoader
@ -50,7 +49,9 @@ def render_template(clients, output, title='TeamspeakStats'):
template_env = Environment(loader=template_loader)
def frmttime(timestamp):
return strftime('%x %X', localtime(int(timestamp)))
if not timestamp:
return ''
return timestamp.strftime('%x %X')
template_env.filters['frmttime'] = frmttime
template = template_env.get_template('template.html')
with open(output, 'w') as f: