_get_meta should return top level meta

This commit is contained in:
Emmanuel Garette 2018-11-16 07:12:44 +01:00
parent f6bdd0c17e
commit b0d4e1983f

View file

@ -135,12 +135,6 @@ class Values(object):
:type index: int :type index: int
:returns: default value :returns: default value
""" """
config_bag = option_bag.config_bag
context = config_bag.context
opt = option_bag.option
index = option_bag.index
if force_index is not None:
index = force_index
def _reset_cache(_value): def _reset_cache(_value):
if not 'expire' in option_bag.properties: if not 'expire' in option_bag.properties:
return return
@ -155,8 +149,14 @@ class Values(object):
# so do not invalidate cache # so do not invalidate cache
return return
# calculated value is a new value, so reset cache # calculated value is a new value, so reset cache
context.cfgimpl_reset_cache(option_bag) config_bag.context.cfgimpl_reset_cache(option_bag)
config_bag = option_bag.config_bag
opt = option_bag.option
if force_index is not None:
index = force_index
else:
index = option_bag.index
moption_bag = self._get_meta(option_bag) moption_bag = self._get_meta(option_bag)
if moption_bag: if moption_bag:
# retrieved value from meta config # retrieved value from meta config
@ -327,9 +327,11 @@ class Values(object):
config_bag.context = meta config_bag.context = meta
doption_bag.config_bag = config_bag doption_bag.config_bag = config_bag
doption_bag.properties = frozenset() doption_bag.properties = frozenset()
if meta.cfgimpl_get_values().is_default_owner(doption_bag): meta_option_bag = meta.cfgimpl_get_values().getowner(doption_bag,
only_default=True)
if meta_option_bag == owners.default:
return None return None
return doption_bag return meta_option_bag
#______________________________________________________________________ #______________________________________________________________________
@ -337,7 +339,7 @@ class Values(object):
def is_default_owner(self, def is_default_owner(self,
option_bag, option_bag,
validate_meta=undefined): validate_meta=True):
return self.getowner(option_bag, return self.getowner(option_bag,
validate_meta=validate_meta, validate_meta=validate_meta,
only_default=True) == owners.default only_default=True) == owners.default
@ -369,7 +371,7 @@ class Values(object):
if only_default: if only_default:
if self._p_.hasvalue(option_bag.path, if self._p_.hasvalue(option_bag.path,
option_bag.index): option_bag.index):
owner = undefined owner = option_bag
else: else:
owner = owners.default owner = owners.default
else: else: