Add onlinetimethreshold config and cli-option

to set render_template.onlinetime_threshold.
Default value is -1 => no filtering to not cause confusion
This commit is contained in:
Thor77 2016-11-11 18:40:52 +01:00
parent 4ac27143a6
commit 5637a11b2b
2 changed files with 9 additions and 2 deletions

View File

@ -50,6 +50,10 @@ def cli():
'-dtf', '--datetimeformat', '-dtf', '--datetimeformat',
type=str, help='format of date/time-values (datetime.strftime)' type=str, help='format of date/time-values (datetime.strftime)'
) )
parser.add_argument(
'-otth', '--onlinetimethreshold',
type=int, help='threshold for displaying onlinetime (in seconds)'
)
options = parser.parse_args() options = parser.parse_args()
if 'config' in options: if 'config' in options:
configuration = config.load(options.config) configuration = config.load(options.config)
@ -91,7 +95,9 @@ def main(configuration):
clients, clients,
output=abspath(configuration.get('General', 'output') + ext), output=abspath(configuration.get('General', 'output') + ext),
template_path=configuration.get('General', 'template'), template_path=configuration.get('General', 'template'),
datetime_fmt=configuration.get('General', 'datetimeformat') datetime_fmt=configuration.get('General', 'datetimeformat'),
onlinetime_threshold=int(configuration.get(
'General', 'onlinetimethreshold'))
) )

View File

@ -18,7 +18,8 @@ DEFAULT_CONFIG = {
'idmap': '', 'idmap': '',
'onlinedc': True, 'onlinedc': True,
'template': 'template.html', 'template': 'template.html',
'datetimeformat': '%x %X %Z' 'datetimeformat': '%x %X %Z',
'onlinetimethreshold': -1
} }
} }