From b0d4e1983ff24f0a44e1408840b2f7b1d172d1a7 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 16 Nov 2018 07:12:44 +0100 Subject: [PATCH] _get_meta should return top level meta --- tiramisu/value.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tiramisu/value.py b/tiramisu/value.py index 263d6ee..d1e6144 100644 --- a/tiramisu/value.py +++ b/tiramisu/value.py @@ -135,12 +135,6 @@ class Values(object): :type index: int :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): if not 'expire' in option_bag.properties: return @@ -155,8 +149,14 @@ class Values(object): # so do not invalidate cache return # 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) if moption_bag: # retrieved value from meta config @@ -327,9 +327,11 @@ class Values(object): config_bag.context = meta doption_bag.config_bag = config_bag 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 doption_bag + return meta_option_bag #______________________________________________________________________ @@ -337,7 +339,7 @@ class Values(object): def is_default_owner(self, option_bag, - validate_meta=undefined): + validate_meta=True): return self.getowner(option_bag, validate_meta=validate_meta, only_default=True) == owners.default @@ -369,7 +371,7 @@ class Values(object): if only_default: if self._p_.hasvalue(option_bag.path, option_bag.index): - owner = undefined + owner = option_bag else: owner = owners.default else: