From dc2abe21d24a04aa36b9c8bd2e95d32982c225f8 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 21 Jul 2017 00:00:26 +0800 Subject: configs/manager.py: get_path() return None if value is an empty string Signed-off-by: Aaron LI --- fg21sim/configs/manager.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fg21sim/configs/manager.py b/fg21sim/configs/manager.py index 172811a..44df01c 100644 --- a/fg21sim/configs/manager.py +++ b/fg21sim/configs/manager.py @@ -432,8 +432,8 @@ class ConfigManager: ------- path : str The absolute path (if user configuration loaded) or relative - path specified by the input key, or ``None`` if specified - config is ``None``. + path specified by the input key, or ``None`` if the specified + config has value of ``None`` or an empty string. Raises ------ @@ -450,6 +450,9 @@ class ConfigManager: if value is None: logger.warning("Specified config '%s' is None or not exist" % key) return None + if value == "": + logger.warning("Specified config '%s' is an empty string" % key) + return None if not isinstance(value, str): msg = "Specified config '%s' is non-string: %s" % (key, value) logger.error(msg) -- cgit v1.2.2