Update config loader so it correctly handles default config values which
are falsey.
@@ -35,6 +35,8 @@ __all__ = [
LOG = logging.getLogger(__name__)
+DEFAULT_VALUE_MAGIC_MARKER = '~~***---%%--%%--%--%%%***~~~+++'
+
class ContentPackConfigLoader(object):
"""
@@ -153,11 +155,14 @@ class ContentPackConfigLoader(object):
:rtype: ``dict``
"""
for schema_item_key, schema_item in six.iteritems(schema):
- default_value = schema_item.get('default', None)
+ default_value = schema_item.get('default', DEFAULT_VALUE_MAGIC_MARKER)
is_object = schema_item.get('type', None) == 'object'
has_properties = schema_item.get('properties', None)
+ config_value = config.get(schema_item_key, DEFAULT_VALUE_MAGIC_MARKER)
- if default_value and not config.get(schema_item_key, None):
+ if (default_value != DEFAULT_VALUE_MAGIC_MARKER and
+ config_value == DEFAULT_VALUE_MAGIC_MARKER):
+ # Config value is not provided, but default value is, use a default value
config[schema_item_key] = default_value
# Inspect nested object properties
