comparison configmix/config.py @ 404:6a5aea02f3d0

Implement a ".is_jail" flag for configuration objects: to test/assert whether we expect a jail configuration
author Franz Glasner <f.glasner@feldmann-mg.com>
date Fri, 19 Nov 2021 12:40:23 +0100
parents 727ec2fc8e7e
children af367e1d0950
comparison
equal deleted inserted replaced
403:7db59202c9af 404:6a5aea02f3d0
70 _STARTTOK_REF = _STARTTOK + REF_NAMESPACE + _NS_SEPARATOR 70 _STARTTOK_REF = _STARTTOK + REF_NAMESPACE + _NS_SEPARATOR
71 _ENDTOK_REF = _ENDTOK 71 _ENDTOK_REF = _ENDTOK
72 _DOT = u(b'.') 72 _DOT = u(b'.')
73 _QUOTE = u(b'%') 73 _QUOTE = u(b'%')
74 _COMMENT = u(b'#') 74 _COMMENT = u(b'#')
75
76 is_jail = False
77 """Flag to show that this is not a jail for another configuration"""
75 78
76 def getvarl(self, *path, **kwds): 79 def getvarl(self, *path, **kwds):
77 """Get a variable where the hierarchy is given in `path` as sequence 80 """Get a variable where the hierarchy is given in `path` as sequence
78 and the namespace is given in the `namespace` keyword argument. 81 and the namespace is given in the `namespace` keyword argument.
79 82
706 709
707 """ 710 """
708 711
709 __slots__ = ("_base", "_path", "_pathstr") 712 __slots__ = ("_base", "_path", "_pathstr")
710 713
714 is_jail = True
715 """Flag to show that this is a jail for another configuration"""
716
711 def __init__(self, config, *path): 717 def __init__(self, config, *path):
712 super(_JailedConfiguration, self).__init__() 718 super(_JailedConfiguration, self).__init__()
713 self._base = config 719 self._base = config
714 self._path = path 720 self._path = path
715 if path: 721 if path: