comparison configmix/config.py @ 449:5864977bb44f

FIX: KeyError formatting. For jailed configs: self._path is a tuple and must be wrapped into a tuple when used for "%"-style error formatting.
author Franz Glasner <f.glasner@feldmann-mg.com>
date Tue, 14 Dec 2021 14:28:10 +0100
parents b95c12781497
children 12f25ac6a13b
comparison
equal deleted inserted replaced
448:b95c12781497 449:5864977bb44f
842 self._base = new_base 842 self._base = new_base
843 # 843 #
844 # Early error out if the chroot does not exist but allow 844 # Early error out if the chroot does not exist but allow
845 # degenerated case if `self._path` is empty. 845 # degenerated case if `self._path` is empty.
846 # 846 #
847 if self._path: 847 if self._path and self._path not in new_base:
848 new_base.getvarl(*self._path) 848 raise KeyError(
849 "base key path %r not available in the new base"
850 % (self._path, ))
849 851
850 def __getattr__(self, name): 852 def __getattr__(self, name):
851 try: 853 try:
852 v = self._base.getvarl_s(*(self._path + (name, ))) 854 v = self._base.getvarl_s(*(self._path + (name, )))
853 except KeyError: 855 except KeyError: