Make bools correctly display as booleans
dbus.Boolean gets converted to int when translating
to json. If we convert it to python bool first it
gets displayed as a bool.
Tested-by: Navigated to debug server and saw all bools
read as "true" and "false" instead of 1 and 0.
Change-Id: Ic47bacab86ca5a58da435d27290cded98957cb21
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/rest-dbus b/rest-dbus
index a830dbf..690c825 100644
--- a/rest-dbus
+++ b/rest-dbus
@@ -184,6 +184,12 @@
iface = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')
try:
properties = iface.GetAll(interface_name)
+ # change dbus.boolean to actual bool so it doesn't get converted
+ # to an int
+ for k in properties.keys():
+ val = properties[k]
+ if isinstance(val, dbus.Boolean):
+ properties[k] = bool(val)
except dbus.DBusException:
properties = []