mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
pywb_init: auto-collections init: inherit shared archive_paths, if any are set in main config.yaml
This commit is contained in:
parent
6a3ca566db
commit
a7307a6d98
@ -24,7 +24,7 @@ import logging
|
|||||||
|
|
||||||
|
|
||||||
#=================================================================
|
#=================================================================
|
||||||
class DictChain:
|
class DictChain(object):
|
||||||
def __init__(self, *dicts):
|
def __init__(self, *dicts):
|
||||||
self.dicts = dicts
|
self.dicts = dicts
|
||||||
|
|
||||||
@ -35,6 +35,12 @@ class DictChain:
|
|||||||
return val
|
return val
|
||||||
return default_val
|
return default_val
|
||||||
|
|
||||||
|
def __contains__(self, key):
|
||||||
|
return self.get(key) is not None
|
||||||
|
|
||||||
|
def __setitem__(self, key, value):
|
||||||
|
self.dicts[0][key] = value
|
||||||
|
|
||||||
|
|
||||||
#=================================================================
|
#=================================================================
|
||||||
def create_wb_handler(query_handler, config):
|
def create_wb_handler(query_handler, config):
|
||||||
@ -199,7 +205,10 @@ class DirectoryCollsLoader(object):
|
|||||||
coll_config['metadata'] = metadata
|
coll_config['metadata'] = metadata
|
||||||
|
|
||||||
self._add_dir_if_exists(coll_config, root_dir, 'index_paths', True)
|
self._add_dir_if_exists(coll_config, root_dir, 'index_paths', True)
|
||||||
self._add_dir_if_exists(coll_config, root_dir, 'archive_paths', True)
|
|
||||||
|
# inherit these properties from base, in case archive_paths is shared
|
||||||
|
shared_config = DictChain(coll_config, self.config)
|
||||||
|
self._add_dir_if_exists(shared_config, root_dir, 'archive_paths', True)
|
||||||
|
|
||||||
if self._add_dir_if_exists(coll_config, root_dir, 'static_path', False):
|
if self._add_dir_if_exists(coll_config, root_dir, 'static_path', False):
|
||||||
self.static_routes['static/' + name] = coll_config['static_path']
|
self.static_routes['static/' + name] = coll_config['static_path']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user