Mercurial > hgrepos > Python > libs > ConfigMix
diff configmix/config.py @ 416:2abde0d3c735
FIX: Handle .jailed() with an empty "root" properly
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 01 Dec 2021 23:09:00 +0100 |
| parents | 816327e178b0 |
| children | 83d537f1dfbb |
line wrap: on
line diff
--- a/configmix/config.py Mon Nov 22 09:34:16 2021 +0100 +++ b/configmix/config.py Wed Dec 01 23:09:00 2021 +0100 @@ -689,16 +689,21 @@ raise ValueError("only one of `rootpath' or `root' can be given") if rootpath is None and root is None: raise ValueError("one of `rootpath' or `root' must be given") + if rootpath is not None and not isinstance(rootpath, (list, tuple)): + raise TypeError("`rootpath' must be a list or a tuple") if root is not None: # convert to path varns, varname = self._split_ns(root) if varns: raise ValueError( "jailed configurations do not support namespaces") - rootpath = [ - self.unquote(p) for p in root.split( - self._HIER_SEPARATOR) - ] + if varname: + rootpath = [ + self.unquote(p) for p in root.split( + self._HIER_SEPARATOR) + ] + else: + rootpath = tuple() jc = _JailedConfiguration(*rootpath) if bind_root: jc.rebind(self)
