comparison configmix/config.py @ 397:88239f28415c

Docs
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 18 Nov 2021 22:29:05 +0100
parents a50f8fb16b05
children b1f82b853290
comparison
equal deleted inserted replaced
396:a50f8fb16b05 397:88239f28415c
652 return ''.join(res) 652 return ''.join(res)
653 653
654 def jailed(self, rootpath=None, root=None): 654 def jailed(self, rootpath=None, root=None):
655 """Return a "jailed" configuration. 655 """Return a "jailed" configuration.
656 656
657 :return: a jailed (aka restricted) configuration
658 :rtype: _JailedConfiguration
659
657 """ 660 """
658 if rootpath is not None and root is not None: 661 if rootpath is not None and root is not None:
659 raise ValueError("only one of `rootpath' or `root' can be given") 662 raise ValueError("only one of `rootpath' or `root' can be given")
660 if rootpath is None and root is None: 663 if rootpath is None and root is None:
661 raise ValueError("one of `rootpath' or `root' must be given") 664 raise ValueError("one of `rootpath' or `root' must be given")
673 return _JailedConfiguration(self, *rootpath) 676 return _JailedConfiguration(self, *rootpath)
674 677
675 678
676 class _JailedConfiguration(object): 679 class _JailedConfiguration(object):
677 680
678 """Chrooted into a subtree of the configuration -- no namespace support""" 681 """A jailed and restricted variant of :class:`Configuration`.
682
683 No namespace support.
684
685 """
679 686
680 __slots__ = ("_base", "_path", "_pathstr") 687 __slots__ = ("_base", "_path", "_pathstr")
681 688
682 def __init__(self, config, *path): 689 def __init__(self, config, *path):
683 super(_JailedConfiguration, self).__init__() 690 super(_JailedConfiguration, self).__init__()