Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix boolean config
  • Loading branch information
fritz-smh committed Oct 1, 2015
1 parent 0192e5d commit 19dbc15
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/domogik/common/plugin.py
Expand Up @@ -280,9 +280,11 @@ def cast_config_value(self, key, value):
"""
for idx in range(len(self.json_data['configuration'])):
if self.json_data['configuration'][idx]['key'] == key:
type = self.json_data['configuration'][idx]['default']
type = self.json_data['configuration'][idx]['type']
self.log.info(u"Casting value for key '{0}' in type '{1}'...".format(key, type))
return self.cast(value, type)
cvalue = self.cast(value, type)
self.log.info(u"Value is : {0}".format(cvalue))
return cvalue

# no cast operation : return the value
if value == "None":
Expand All @@ -298,9 +300,9 @@ def cast(self, value, type):
if type == "boolean":
# just in case, the "True"/"False" are not already converted in True/False
# this is (currently) done on queryconfig side
if value == "True":
if value in ["True", "Y"]:
return True
elif value == "False":
elif value in ["False", "N"]:
return False
# type == choice : nothing to do
if type == "date":
Expand Down

0 comments on commit 19dbc15

Please sign in to comment.