Fix conversion of string bools to bools

This commit is contained in:
sfan5
2014-07-03 13:10:47 +02:00
parent 9a75f8e38e
commit 794741fa1f

View File

@@ -253,10 +253,10 @@ def checkRequest(server):
if data[0]: return False
else: continue
#### Compatibility code ####
# Accept anything in boolean fields but convert it to a
# boolean, because old servers send some booleans as strings.
if data[1] == "bool":
server[name] = True if server[name] else False
# Accept strings in boolean fields but convert it to a
# boolean, because old servers sent some booleans as strings.
if data[1] == "bool" and type(server[name]).__name__ == "str":
server[name] = True if server[name].lower() in ["true", "1"] else False
continue
# clients_max was sent as a string instead of an integer
if name == "clients_max" and type(server[name]).__name__ == "str":