1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

config system: some fixes for auto-init, add trailing '/' for dir paths, #55

This commit is contained in:
Ilya Kreymer 2015-02-25 13:15:48 -08:00
parent 7c60bf17f7
commit 5c67782a2c

View File

@ -105,7 +105,10 @@ def create_cdx_server_app(passed_config):
For each collection, create a /<coll>-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')