added condition for key
This commit is contained in:
@@ -132,13 +132,14 @@ class Config(object):
|
|||||||
config[name] = template['min']
|
config[name] = template['min']
|
||||||
|
|
||||||
if template['type'] == 'list':
|
if template['type'] == 'list':
|
||||||
config = config[name]
|
if 'index' in template:
|
||||||
|
config = config[name]
|
||||||
|
|
||||||
for i in range(len(template['index'])):
|
for i in range(len(template['index'])):
|
||||||
if len(config) <= i: config.append({})
|
if len(config) <= i: config.append({})
|
||||||
|
|
||||||
for name, tmpl in template['template'].items():
|
for name, tmpl in template['template'].items():
|
||||||
self.__defaults(config[i], name, tmpl)
|
self.__defaults(config[i], name, tmpl)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
for name, tmpl in template.items():
|
for name, tmpl in template.items():
|
||||||
@@ -214,11 +215,14 @@ class Config(object):
|
|||||||
|
|
||||||
# Handle list
|
# Handle list
|
||||||
if tmpl['type'] == 'list':
|
if tmpl['type'] == 'list':
|
||||||
for i in range(len(tmpl['index'])):
|
if 'index' in tmpl:
|
||||||
if config is not None and i < len(config): conf = config[i]
|
for i in range(len(tmpl['index'])):
|
||||||
else: conf = None
|
if config is not None and i < len(config): conf = config[i]
|
||||||
self._encode(name, index + tmpl['index'][i], conf,
|
else: conf = None
|
||||||
tmpl['template'], with_defaults)
|
self._encode(name, index + tmpl['index'][i], conf,
|
||||||
|
tmpl['template'], with_defaults)
|
||||||
|
else:
|
||||||
|
self.values[name]=value;
|
||||||
return
|
return
|
||||||
|
|
||||||
# Update config values
|
# Update config values
|
||||||
|
|||||||
Reference in New Issue
Block a user