Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/config.py @ 399:b45403d175a0
Docs
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 19 Nov 2021 01:59:42 +0100 |
| parents | b1f82b853290 |
| children | 727ec2fc8e7e |
comparison
equal
deleted
inserted
replaced
| 398:b1f82b853290 | 399:b45403d175a0 |
|---|---|
| 650 else: | 650 else: |
| 651 raise ValueError("unknown quote syntax string: {}".format(s)) | 651 raise ValueError("unknown quote syntax string: {}".format(s)) |
| 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 of the current configuration. |
| 656 | 656 |
| 657 :param rootpath: a sequence of strings that shall emcompass | |
| 658 the chroot-like jail of the returned | |
| 659 configuration | |
| 660 :type rootpath: list or tuple | |
| 661 :param str root: a string path expression that shall encompass | |
| 662 the chroot-like jail of the returned configuration | |
| 657 :return: a jailed (aka restricted) configuration | 663 :return: a jailed (aka restricted) configuration |
| 658 :rtype: _JailedConfiguration | 664 :rtype: _JailedConfiguration |
| 665 | |
| 666 Exactly one of `rootpath` or `root` must be given. | |
| 659 | 667 |
| 660 """ | 668 """ |
| 661 if rootpath is not None and root is not None: | 669 if rootpath is not None and root is not None: |
| 662 raise ValueError("only one of `rootpath' or `root' can be given") | 670 raise ValueError("only one of `rootpath' or `root' can be given") |
| 663 if rootpath is None and root is None: | 671 if rootpath is None and root is None: |
| 678 | 686 |
| 679 class _JailedConfiguration(object): | 687 class _JailedConfiguration(object): |
| 680 | 688 |
| 681 """A jailed and restricted variant of :class:`Configuration`. | 689 """A jailed and restricted variant of :class:`Configuration`. |
| 682 | 690 |
| 683 No namespace support. | 691 Restriction is two-fold: |
| 692 | |
| 693 - The access to configuration variables in `config` is restricted | |
| 694 to the configuration sub-tree that is configured in `path`. | |
| 695 | |
| 696 - Not all access-methods of :class:`Configuration` are implemented | |
| 697 yet. | |
| 698 | |
| 699 .. note:: There is no namespace support. | |
| 700 | |
| 701 .. note:: Do not call the constructor directly. Instantiate a jailed | |
| 702 configuration from the parent configuration's | |
| 703 :meth:`~.Configuration.jailed` factory method. | |
| 684 | 704 |
| 685 """ | 705 """ |
| 686 | 706 |
| 687 __slots__ = ("_base", "_path", "_pathstr") | 707 __slots__ = ("_base", "_path", "_pathstr") |
| 688 | 708 |
