def load_setting_export_timezone(logger, config_settings):
"""
If a user supplied timezone is found in the config settings it will
be used to set the dates in the generated audit report, otherwise
a local timezone will be used.
:param logger: the logger
:param config_settings: config settings loaded from config file
:return: a timezone from config if valid, else local timezone for this machine
"""
try:
timezone = config_settings['export_options']['timezone']
if timezone is None or timezone not in pytz.all_timezones:
timezone = get_localzone()
logger.info('No valid timezone found in config file, defaulting to local timezone')
return str(timezone)
except Exception as ex:
log_critical_error(logger, ex, 'Exception parsing timezone from config file')
timezone = get_localzone()
return str(timezone)
exporter.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录