From 9f068dc4023e38e49a49047c31588c742ed41d53 Mon Sep 17 00:00:00 2001 From: jesseward Date: Tue, 17 Mar 2015 14:46:26 -0400 Subject: [PATCH] Second pass at child directory configuration change. Adding styling and syntax recommendations from jquast. --- x84/bbs/ini.py | 2 -- x84/bbs/session.py | 22 +++++++++------------- x84/webmodules/static.py | 4 ++-- x84/webserve.py | 2 +- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/x84/bbs/ini.py b/x84/bbs/ini.py index 93a39d2f..2e2a2ef4 100644 --- a/x84/bbs/ini.py +++ b/x84/bbs/ini.py @@ -196,8 +196,6 @@ def init_bbs_ini(): cfg_bbs.set('web', 'chain', os.path.expanduser( os.path.join('~', '.x84', 'ca.cer'))) cfg_bbs.set('web', 'modules', 'msgserve') - cfg_bbs.set('web', 'static_files', os.path.abspath( - os.path.join(os.path.dirname(__file__), os.path.pardir, 'default'))) # default path if cmd argument is not absolute, cfg_bbs.add_section('door') diff --git a/x84/bbs/session.py b/x84/bbs/session.py index f5f0fb5d..0de6488d 100644 --- a/x84/bbs/session.py +++ b/x84/bbs/session.py @@ -253,24 +253,19 @@ def show_traceback(self): @property def script_path(self): - """ Base filepath folder for all scripts. + """ + Base filepath folder for all scripts. - rtype: list + :rtype: list """ - val = get_ini('system', 'scriptpath') - - # system.scriptpath setting. - # coerce scriptpath to a list. Multiple scriptpath values allow the - # ability to override the x84/default modules, without modifying the - # original source tree files. - val = val.split(',') + scriptpath_dirs = get_ini('system', 'scriptpath', split=True) # ensure all specified folders exist - for directory in val: + for directory in scriptpath_dirs: assert os.path.isdir(directory), ( 'configuration section [system], value scriptpath: ' 'not a folder: {!r}'.format(directory)) - return val + return scriptpath_dirs @property def current_script(self): @@ -282,9 +277,10 @@ def current_script(self): @property def script_module(self): - """ Base python module instance for userland scripts. + """ + Base python module instance for userland scripts. - rtype: list + :rtype: list """ if not self._script_module: diff --git a/x84/webmodules/static.py b/x84/webmodules/static.py index cd60add1..82188a61 100644 --- a/x84/webmodules/static.py +++ b/x84/webmodules/static.py @@ -44,8 +44,8 @@ def web_module(): # determine document root for web server static_root = (get_ini('web', 'document_root') - or os.path.join(get_ini('system', 'scriptpath').split(',')[0], - 'www-static')) + or os.path.join(get_ini('system', 'scriptpath', + split=True)[0], 'www-static')) StaticApp.static_root = static_root return { diff --git a/x84/webserve.py b/x84/webserve.py index dc7c5abd..3463f8bd 100755 --- a/x84/webserve.py +++ b/x84/webserve.py @@ -191,7 +191,7 @@ def main(background_daemon=True): log = logging.getLogger(__name__) - SCRIPT_PATH = get_ini(section='system', key='scriptpath').split(',') + SCRIPT_PATH = get_ini(section='system', key='scriptpath', split=True) # ensure the SCRIPT_PATH is in os environment PATH for module lookup. for directory in SCRIPT_PATH: