From 41c2341bf705414939b55de2af0450646455ce3d Mon Sep 17 00:00:00 2001 From: chrys87 Date: Thu, 25 Aug 2016 17:28:46 +0200 Subject: [PATCH] Update time.py --- src/fenrir-package/commands/time.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/fenrir-package/commands/time.py b/src/fenrir-package/commands/time.py index 1cbfead8..84d5fe0a 100644 --- a/src/fenrir-package/commands/time.py +++ b/src/fenrir-package/commands/time.py @@ -4,12 +4,15 @@ class command(): def __init__(self): pass def run(self, environment): - try: - #Need to load time string from config file. - except Exception as e: - # Sane default - timeString = '%H:%M;%P' - + #this is the way to load the settings: + # general is the section in the config file, timeFormat is the variable + # this has to been added to settings.conf in sectino [general] + # timeFormat=%H:%M;%P + # the following has to been added to core/settings.py to the key 'general' + # the settings.py is used for default values + # 'timeFormat':"%H:%M;%P", + timeString = environment['runtime']['settingsManager'].getSetting(environment,'general', 'timeFormat') + timeString = datetime.datetime.strftime(datetime.datetime.now(), '%H:%M:%P') return environment def setCallback(self, callback):