|
@@ -87,12 +87,12 @@ class ConfigData:
|
|
def __init__(self, specification):
|
|
def __init__(self, specification):
|
|
self.specification = specification
|
|
self.specification = specification
|
|
|
|
|
|
- def get_value(self, identifier):
|
|
|
|
|
|
+ def get_default_value(self, identifier):
|
|
"""Returns a tuple where the first item is the value at the
|
|
"""Returns a tuple where the first item is the value at the
|
|
given identifier, and the second item is a bool which is
|
|
given identifier, and the second item is a bool which is
|
|
true if the value is an unset default. Raises an
|
|
true if the value is an unset default. Raises an
|
|
DataNotFoundError if the identifier is bad"""
|
|
DataNotFoundError if the identifier is bad"""
|
|
- def _get_value(config_map):
|
|
|
|
|
|
+ def _get_default_value(config_map):
|
|
if 'item_default' in config_map:
|
|
if 'item_default' in config_map:
|
|
return config_map['item_default'], False
|
|
return config_map['item_default'], False
|
|
elif 'item_type' in config_map:
|
|
elif 'item_type' in config_map:
|
|
@@ -105,16 +105,16 @@ class ConfigData:
|
|
elif config_map['item_type'] in set(['float', 'double', 'real']):
|
|
elif config_map['item_type'] in set(['float', 'double', 'real']):
|
|
return float(), True
|
|
return float(), True
|
|
elif config_map['item_type'] in set(['list', 'array']):
|
|
elif config_map['item_type'] in set(['list', 'array']):
|
|
- return [ _get_value(conf)
|
|
|
|
|
|
+ return [ _get_default_value(conf)
|
|
for conf in spec['list_item_spec'] ], True
|
|
for conf in spec['list_item_spec'] ], True
|
|
elif config_map['item_type'] in set(['map', 'object']):
|
|
elif config_map['item_type'] in set(['map', 'object']):
|
|
return dict(
|
|
return dict(
|
|
- [ (conf['item_name'], _get_value(conf))
|
|
|
|
|
|
+ [ (conf['item_name'], _get_default_value(conf))
|
|
for conf in config_map['map_item_spec'] ]), True
|
|
for conf in config_map['map_item_spec'] ]), True
|
|
return None, True
|
|
return None, True
|
|
for config_map in self.get_module_spec().get_config_spec():
|
|
for config_map in self.get_module_spec().get_config_spec():
|
|
if config_map['item_name'] == identifier:
|
|
if config_map['item_name'] == identifier:
|
|
- return _get_value(config_map)
|
|
|
|
|
|
+ return _get_default_value(config_map)
|
|
raise DataNotFoundError("item_name %s is not found in the specfile" % identifier)
|
|
raise DataNotFoundError("item_name %s is not found in the specfile" % identifier)
|
|
|
|
|
|
def get_module_spec(self):
|
|
def get_module_spec(self):
|