Handle missing settingsversion. #1747
|
@ -128,6 +128,8 @@ def loadConfig():
|
|||
def updateConfig():
|
||||
"""Save the config"""
|
||||
config = BMConfigParser()
|
||||
if not config.has_option('bitmessagesettings', 'settingsversion'):
|
||||
config.set('bitmessagesettings', 'settingsversion', 1)
|
||||
settingsversion = config.getint('bitmessagesettings', 'settingsversion')
|
||||
|
||||
if settingsversion == 1:
|
||||
config.set('bitmessagesettings', 'socksproxytype', 'none')
|
||||
|
|
Reference in New Issue
Block a user
Better to just add a default value into
src/bmconfigparser.py
Adding it like this at least doesn't help:
Try using
safeGetInt
instead ofgetint
in addition to adding the default value into the dict.switching to safegetint makes no difference whether settingsversion is included in BMConfigDefaults or not. No idea what the underlying cause is but my proposed fix adds only two lines...
No default or the default from
BMConfigDefaults
is a possible bonus of python3 configparser.Again, please read the tests: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/src/tests/test_config.py#L40
Current PyBitmessage code should pass the tests.
@PeterSurda FIXME: It is also considered to be an exceptional case in current code when you open an existing config and it has no settings version. That's why
getint()
was retained there I think.The code you give is one of the changes I tried with stated effect. To me looks like only error from tests is in Ui_MainWindow which isn't related to this as far as I can see. If you want me to make additional changes you'll have to be more specific than "rest the tests".