Set and get don't work symetrically for config parser sections bwahahaha

This commit is contained in:
mlncn 2021-05-02 23:19:40 -04:00
parent 206530b235
commit 0077a27da0

View file

@ -9,7 +9,7 @@ pomodoro = config['pomodoro']
if not os.path.isfile('settings.ini'): if not os.path.isfile('settings.ini'):
# Set some essential initial values. # Set some essential initial values.
pomodoro['logfile'] = '~/Projects/agaric/python/pomodoroprompt/logs/2021.csv' pomodoro['logfile'] = '~/Projects/agaric/python/pomodoroprompt/log/2021.csv'
write() write()
config.read('settings.ini') config.read('settings.ini')
@ -22,9 +22,9 @@ def write():
def pomodoro_logfile(): def pomodoro_logfile():
return config['pomodoro']['logfile'] return config['pomodoro']['logfile']
def pomodoro_latest_recorded(value = None): def pomodoro_latest_recorded(timestamp = None):
if value: if timestamp:
pomodoro.set('latest_recorded', value) config.set('pomodoro', 'latest_recorded', str(timestamp))
write() write()
else: else:
return pomodoro.get('latest_recorded', None) return pomodoro.get('latest_recorded', None)