add a __contains__ method to the config class
fix upgrading old configs when the key doesn't exist in the old config
This commit is contained in:
parent
445096378c
commit
b3975bd4c2
@ -156,6 +156,9 @@ class Config(object):
|
|||||||
|
|
||||||
self.load()
|
self.load()
|
||||||
|
|
||||||
|
def __contains__(self, item):
|
||||||
|
return item in self.__config
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
"""
|
"""
|
||||||
See
|
See
|
||||||
|
|||||||
@ -463,7 +463,8 @@ class DelugeWeb(component.Component):
|
|||||||
# all the values across to the new config file, and then remove
|
# all the values across to the new config file, and then remove
|
||||||
# it.
|
# it.
|
||||||
for key in OLD_CONFIG_KEYS:
|
for key in OLD_CONFIG_KEYS:
|
||||||
self.config[key] = old_config[key]
|
if key in old_config:
|
||||||
|
self.config[key] = old_config[key]
|
||||||
|
|
||||||
# We need to base64 encode the passwords since json can't handle
|
# We need to base64 encode the passwords since json can't handle
|
||||||
# them otherwise.
|
# them otherwise.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user