From 5c67782a2cd4513a787c34ae241b4d887f3b0f5c Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Wed, 25 Feb 2015 13:15:48 -0800 Subject: [PATCH] config system: some fixes for auto-init, add trailing '/' for dir paths, #55 --- pywb/webapp/pywb_init.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pywb/webapp/pywb_init.py b/pywb/webapp/pywb_init.py index 09315be4..2cafe376 100644 --- a/pywb/webapp/pywb_init.py +++ b/pywb/webapp/pywb_init.py @@ -105,7 +105,10 @@ def create_cdx_server_app(passed_config): For each collection, create a /-cdx access point which follows the cdx api """ - config = DictChain(passed_config, DEFAULTS) + + defaults = load_yaml_config(DEFAULT_CONFIG) + + config = DictChain(passed_config, defaults) collections = config.get('collections') @@ -163,7 +166,8 @@ class DirectoryCollsLoader(object): fulldir = os.path.join(root_dir, thedir) if os.path.isdir(fulldir): - coll[dir_key] = fulldir.rstrip('/') + fulldir = os.path.abspath(fulldir) + os.path.sep + coll[dir_key] = fulldir return True elif required: msg = 'Dir "{0}" does not exist for "{1}"'.format(fulldir, dir_key) @@ -182,7 +186,7 @@ class DirectoryCollsLoader(object): self._add_if_exists(coll, root_dir, 'archive_paths', True) if self._add_if_exists(coll, root_dir, 'static_path', False): - self.static_routes['static/' + name] = coll['static_path'] + '/' + self.static_routes['static/' + name] = coll['static_path'] # Add templates templates_dir = self.config.get('paths').get('templates_dir')