JSON Config: Convert float to int (bug 1590)

If th
This commit is contained in:
Thomas Perl 2012-04-29 18:08:44 +02:00
parent 8973c1e21f
commit 8805b0dc94
1 changed files with 5 additions and 0 deletions

View File

@ -164,6 +164,11 @@ class JsonConfig(object):
elif isinstance(value, dict):
# Recurse into sub-dictionaries
work_queue.append((data[key], value))
elif type(value) != type(data[key]):
# Type mismatch of current value and default
if type(value) == int and type(data[key]) == float:
# Convert float to int if default value is int
data[key] = int(data[key])
return added_new_key