aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/configs
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-11-04 20:19:12 +0800
committerAaron LI <aaronly.me@outlook.com>2016-11-04 20:19:12 +0800
commit939e92de6241906bdfd39b51552079855af2eaf5 (patch)
tree886421d80e728711db2b3737e7237bf21fcf0f44 /fg21sim/configs
parent72b257e03b1e3405e2233a0cf86b2d8f851d6c14 (diff)
downloadfg21sim-939e92de6241906bdfd39b51552079855af2eaf5.tar.bz2
webui: websocket.py: Implement "set" action for "_handle_configs()"
Finish the "_set_configs()" function to implement the "set" action for "_handle_configs()". Also change the "status" keyword to "success" to be more intuitive.
Diffstat (limited to 'fg21sim/configs')
-rw-r--r--fg21sim/configs/manager.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/fg21sim/configs/manager.py b/fg21sim/configs/manager.py
index 0809126..b19978b 100644
--- a/fg21sim/configs/manager.py
+++ b/fg21sim/configs/manager.py
@@ -337,7 +337,7 @@ class ConfigManager:
val_new = reduce(operator.getitem, key, config_new)
d2 = reduce(lambda x, y: {y: x}, reversed(key), val_new)
self.merge(d2)
- logger.info("Set config: {key}: {val_new} <= {val_old}".format(
+ logger.info("Set config: {key}: {val_new} <- {val_old}".format(
key="/".join(key), val_new=val_new, val_old=val_old))
def get_path(self, key):
@@ -364,9 +364,9 @@ class ConfigManager:
NOTE
----
- - The "~" (tilde) inside path is expanded to the user home directory.
+ - The beginning ``~`` (tilde) is expanded to user's home directory.
- The relative path (with respect to the user configuration file)
- is converted to absolute path if `self.userconfig` presents.
+ is converted to absolute path if ``self.userconfig`` is valid.
"""
value = self.getn(key)
if value is None:
@@ -379,8 +379,8 @@ class ConfigManager:
#
path = os.path.expanduser(value)
if not os.path.isabs(path):
- # Got relative path, try to convert to the absolute path
- if hasattr(self, "userconfig"):
+ # Got a relative path, try to convert to the absolute path
+ if self.userconfig is not None:
# User configuration loaded
path = os.path.join(os.path.dirname(self.userconfig), path)
else: