From 744ff585d5b100d0a75f03ae20b63eb83a293fbc Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 1 Mar 2024 13:19:46 +0800 Subject: [PATCH] bugfix --- ahserver/globalEnv.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ahserver/globalEnv.py b/ahserver/globalEnv.py index d98b99d..76aa059 100755 --- a/ahserver/globalEnv.py +++ b/ahserver/globalEnv.py @@ -60,6 +60,18 @@ class FileOutZone(Exception): def __str__(self): return self.openfilename + ': not allowed to open' +def get_config_value(kstr): + keys = kstr.split('.') + config = getConfig() + for k in keys: + config = config.get(k) + if not config: + return None + return config + +def get_definition(k): + return get_config_value(f'definition.{k}') + def openfile(url,m): fp = abspath(url) if fp is None: @@ -169,3 +181,6 @@ def initEnv(): g.NoPermission = NoPermission g.password_encode = password g.current_fileno = current_fileno + g.get_config_value = get_config_value + g.get_definition = get_definition +