From 7c197c23437c7bf161acbb173e1b5f2201614663 Mon Sep 17 00:00:00 2001 From: Schimon Jehudah Date: Wed, 13 Mar 2024 12:09:48 +0000 Subject: [PATCH] Fix malfunction when setting value of key "old" to zero (Thank you roughnecks). --- slixfeed/sqlite.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/slixfeed/sqlite.py b/slixfeed/sqlite.py index 2d25a69..d819f4c 100644 --- a/slixfeed/sqlite.py +++ b/slixfeed/sqlite.py @@ -2503,8 +2503,14 @@ async def set_setting_value(db_file, key_value): logger.debug('{}: db_file: {} key: {} val: {}' .format(function_name, db_file, key, val)) - if not val: - raise Exception('Missing value for key "{}" ({}).'.format(key, db_file)) + # NOTE This is not a good practice! + # When INI file was used, all values were strings. + # When TOML is now used, integers are integers, which means that + # statement "if not val" is equivalent to "if not 0" which is not so to + # statement "if not '0'" + + # if not val: + # raise Exception('Missing value for key "{}" ({}).'.format(key, db_file)) # logger.error('Missing value for key "{}" ({}).'.format(key, db_file)) # return