summaryrefslogtreecommitdiffstats
path: root/module/obmc/wsgi/examples/websockets
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2018-06-25 14:11:58 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-08-28 01:09:41 +0000
commit6691e7ca4e2adf52bac1fc3a82ed35adfce4349c (patch)
treeeb646e7aed71f4f09c1c06508209282f9f5950a5 /module/obmc/wsgi/examples/websockets
parenta8b05d161ef3367f3fc2f4a5e44a2b0b69a9f3d2 (diff)
downloadphosphor-rest-server-6691e7ca4e2adf52bac1fc3a82ed35adfce4349c.tar.gz
phosphor-rest-server-6691e7ca4e2adf52bac1fc3a82ed35adfce4349c.zip
Explicitly convert dbus.Booleans to bools
The dbus.Boolean data type that the dbus python module uses for booleans is based on an int, so the JSON encoder class serializes it to a 1 and 0 instead of the native JSON bool presentation of true and false. Though the encoder module does allow for custom serialization functions, it only does so for data types that it doesn't recognize, and it does recognize a dbus.Boolean though it thinks it's an int. To get around this limitation, walk the response dictionary object and convert all dbus.Booleans to bools before encoding the response. The only time that data is copied is when a boolean is in a dbus.Struct, which is an immutable tuple, so it will be made into a list during revision before converting it back when complete. There is a slight performance penalty to pay for this. Measurements showed enumerating the whole /xyz/openbmc_project tree take about 1 second longer. Resolves openbmc/openbmc#3154 Tested: Lots of REST calls and output inspection. Change-Id: I591f010798a80aeafd02289e3d35c335540f6562 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Diffstat (limited to 'module/obmc/wsgi/examples/websockets')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud