aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/webui
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-11-11 22:58:13 +0800
committerAaron LI <aaronly.me@outlook.com>2016-11-11 22:58:13 +0800
commitd28336f7ec1d5440948e7b3a795c1212c96ee16a (patch)
tree5f86afad6746d3bbf99424c00120b7e74fbf65ed /fg21sim/webui
parentb0808761421d1909d8175986dce7e9ec247515ad (diff)
downloadfg21sim-d28336f7ec1d5440948e7b3a795c1212c96ee16a.tar.bz2
webui: websocket.py: Ignore "configfile"; Allow set "userconfig"
* The "workdir" and "configfile" should be both ignored * Update "_set_configs()" method to allow set "userconfig"
Diffstat (limited to 'fg21sim/webui')
-rw-r--r--fg21sim/webui/websocket.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/fg21sim/webui/websocket.py b/fg21sim/webui/websocket.py
index d205004..53d2da4 100644
--- a/fg21sim/webui/websocket.py
+++ b/fg21sim/webui/websocket.py
@@ -328,7 +328,8 @@ class FG21simWSHandler(tornado.websocket.WebSocketHandler):
NOTE
----
- The ``userconfig`` and ``workdir`` options are ignored.
+ The ``userconfig`` needs special handle.
+ The ``workdir`` and ``configfile`` options should be ignored.
Parameters
----------
@@ -338,8 +339,7 @@ class FG21simWSHandler(tornado.websocket.WebSocketHandler):
to which config options will be set.
NOTE:
If want to set the ``userconfig`` option, an *absolute path*
- must be provided (i.e., client should take care of the ``workdir``
- value and generate a absolute path for ``userconfig``).
+ must be provided.
Returns
-------
@@ -349,9 +349,14 @@ class FG21simWSHandler(tornado.websocket.WebSocketHandler):
"""
errors = {}
for key, value in data.items():
- if key in ["userconfig", "workdir"]:
- # Ignore "userconfig" and "workdir"
+ if key in ["workdir", "configfile"]:
+ # Ignore "workdir" and "configfile"
continue
+ elif key == "userconfig":
+ if os.path.isabs(value):
+ self.configs.userconfig = value
+ else:
+ errors[key] = "Not an absolute path"
else:
try:
self.configs.setn(key, value)