Merge one app config (from a dict, file, or filename) into another. If the given config is a filename, it will be appended to the list of files to monitor for "autoreload" changes.
(base, other)
| 129 | |
| 130 | |
| 131 | def merge(base, other): |
| 132 | """Merge one app config (from a dict, file, or filename) into another. |
| 133 | |
| 134 | If the given config is a filename, it will be appended to the list |
| 135 | of files to monitor for "autoreload" changes. |
| 136 | """ |
| 137 | _if_filename_register_autoreload(other) |
| 138 | |
| 139 | # Load other into base |
| 140 | for section, value_map in reprconf.Parser.load(other).items(): |
| 141 | if not isinstance(value_map, dict): |
| 142 | raise ValueError( |
| 143 | 'Application config must include section headers, but the ' |
| 144 | "config you tried to merge doesn't have any sections. " |
| 145 | 'Wrap your config in another dict with paths as section ' |
| 146 | "headers, for example: {'/': config}.") |
| 147 | base.setdefault(section, {}).update(value_map) |
| 148 | |
| 149 | |
| 150 | class Config(reprconf.Config): |
no test coverage detected
searching dependent graphs…