# HG changeset patch # User Franz Glasner # Date 1686425893 -7200 # Node ID 2e7920b0b4d915f633f8a31816894a85114160cd # Parent a9eef98e5038983712dc48903edbb14569d62daf Because Configuration.getvarl() expands references internally already extra handling of references in .jailed() is not needed diff -r a9eef98e5038 -r 2e7920b0b4d9 configmix/config.py --- a/configmix/config.py Sat Jun 10 11:48:15 2023 +0200 +++ b/configmix/config.py Sat Jun 10 21:38:13 2023 +0200 @@ -1087,8 +1087,7 @@ value = filterfn(self, value) return value - def jailed(self, rootpath=None, root=None, - bind_root=True, resolve_ref=True): + def jailed(self, rootpath=None, root=None, bind_root=True): """Return a "jailed" configuration of the current configuration. :param rootpath: a sequence of strings (or objects) that shall @@ -1101,11 +1100,6 @@ creation of a jailed config you can set `bind_root` to `False`; otherwise use the default - :param bool resolve_ref: If `True` then the jail's root is checked - whether it is a reference. If it is a - reference then the jail is effectively rooted - where the reference points to. This process - is done recursively. :return: a jailed (aka restricted) configuration :rtype: _JailedConfiguration @@ -1125,13 +1119,13 @@ raise ValueError( "jailed configurations do not support namespaces") rootpath = pathstr2path(root) - if resolve_ref: - while True: - target = self.getvarl(*rootpath) - target_uri = self.try_get_reference_uri(target) - if target_uri is None: - break - rootpath = pathstr2path(target_uri) +# if resolve_ref: +# while True: +# target = self.getvarl(*rootpath) +# target_uri = self.try_get_reference_uri(target) +# if target_uri is None: +# break +# rootpath = pathstr2path(target_uri) jc = _JailedConfiguration(*rootpath) if bind_root: jc.rebind(self) @@ -1361,8 +1355,7 @@ """Map- and list-style evaluation in boolean context""" return bool(self._base.getvarl_s(*self._path)) - def jailed(self, rootpath=None, root=None, - bind_root=True, resolve_ref=True): + def jailed(self, rootpath=None, root=None, bind_root=True): """Return a "jailed" configuration that effectively is a subjail of the current jail @@ -1386,13 +1379,13 @@ new_rootpath = self._path + tuple(rootpath) else: new_rootpath = tuple(rootpath) - if resolve_ref: - while True: - target = self._base.getvarl(*new_rootpath) - target_uri = self._base.try_get_reference_uri(target) - if target_uri is None: - break - new_rootpath = pathstr2path(target_uri) +# if resolve_ref: +# while True: +# target = self._base.getvarl(*new_rootpath) +# target_uri = self._base.try_get_reference_uri(target) +# if target_uri is None: +# break +# new_rootpath = pathstr2path(target_uri) sjc = _JailedConfiguration(*new_rootpath) if bind_root: sjc.rebind(self._base)