diff options
author | Aaron LI <aaronly.me@outlook.com> | 2016-11-06 21:10:17 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2016-11-06 21:10:17 +0800 |
commit | bfd8e66f6d3f6a46a42f2e880dcbd94d9abe51dc (patch) | |
tree | f8202a25150a2bc02ba282d304a4cee3fd428b50 /fg21sim/webui | |
parent | 90f69f20da9ce91f6e1ff0a994b92be2d25606f1 (diff) | |
download | fg21sim-bfd8e66f6d3f6a46a42f2e880dcbd94d9abe51dc.tar.bz2 |
webui: websocket.py: Use flattened configs; Change "data" to "keys"
* Get the server-side configurations as a flattened one-level
dictionary, for easier manipulations.
* When get the configurations, specify the requested config options as
an Array under the "keys" property (original: "data" property).
Diffstat (limited to 'fg21sim/webui')
-rw-r--r-- | fg21sim/webui/websocket.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fg21sim/webui/websocket.py b/fg21sim/webui/websocket.py index 23a4423..8c2f427 100644 --- a/fg21sim/webui/websocket.py +++ b/fg21sim/webui/websocket.py @@ -196,13 +196,13 @@ class FG21simWSHandler(tornado.websocket.WebSocketHandler): if msg_action == "get": # Get the values of the specified options try: - data, errors = self._get_configs(keys=msg["data"]) + data, errors = self._get_configs(keys=msg["keys"]) response["success"] = True response["data"] = data response["errors"] = errors except KeyError: response["success"] = False - response["error"] = "'data' is missing" + response["error"] = "'keys' is missing" elif msg_action == "set": # Set the values of the specified options try: @@ -278,7 +278,7 @@ class FG21simWSHandler(tornado.websocket.WebSocketHandler): """ if keys is None: # Dump all the configurations - data = self.configs.dump() + data = self.configs.dump(flatten=True) data["userconfig"] = self.configs.userconfig errors = {} else: |