changeset 685:2e7920b0b4d9

Because Configuration.getvarl() expands references internally already extra handling of references in .jailed() is not needed
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 10 Jun 2023 21:38:13 +0200
parents a9eef98e5038
children 80d203ed3556
files configmix/config.py
diffstat 1 files changed, 16 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- 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)