Fix setting None for config value

This commit is contained in:
Andrew Resch 2008-08-14 05:58:58 +00:00
parent bc64bed102
commit c4d620f0b9
1 changed files with 24 additions and 21 deletions

View File

@ -113,9 +113,12 @@ class Config:
def set(self, key, value):
"""Set the 'key' with 'value'."""
# Sets the "key" with "value" in the config dict
if self.config[key] != value:
if self.config[key] == value:
return
oldtype, newtype = type(self.config[key]), type(value)
if oldtype != newtype:
if value is not None and oldtype != newtype:
try:
value = oldtype(value)
except ValueError: