master
yumoqing 2024-03-01 13:19:46 +08:00
parent eb7cd35d6d
commit 744ff585d5
1 changed files with 15 additions and 0 deletions

View File

@ -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