mirror of
https://github.com/CopterExpress/clever-show.git
synced 2026-05-26 15:13:26 +00:00
Validation upon merge
This commit is contained in:
10
config.py
10
config.py
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import copy
|
||||
import collections
|
||||
|
||||
from configobj import ConfigObj, Section, flatten_errors
|
||||
@@ -249,8 +250,13 @@ class ConfigManager:
|
||||
|
||||
self._load_comments(d, self.config)
|
||||
|
||||
def merge(self, config):
|
||||
self.config.merge(config.config)
|
||||
def merge(self, config, validate=True):
|
||||
current = copy.deepcopy(self.config)
|
||||
current.merge(config.config)
|
||||
if validate:
|
||||
self.validate_config(current)
|
||||
else:
|
||||
self.set_config(current)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user