Add datetime_fmt-arg to tsstats.template.render_template
Specify a custom datetime-format for various datetime-renderings (creation-time, last online)
This commit is contained in:
parent
bd2157c2b8
commit
1ecf24b9b2
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue