Mercurial > hgrepos > Python > libs > ConfigMix
comparison docs/introduction.rst @ 424:e60b72df15de
Introduction into sub-jails
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Tue, 07 Dec 2021 09:23:38 +0100 |
| parents | 727ec2fc8e7e |
| children | 88d8de9310af |
comparison
equal
deleted
inserted
replaced
| 423:5aba893d0dbb | 424:e60b72df15de |
|---|---|
| 579 | 579 |
| 580 All access methods in a jailed configuration automatically prepend the | 580 All access methods in a jailed configuration automatically prepend the |
| 581 given `root path` in order to get the effective key into the base | 581 given `root path` in order to get the effective key into the base |
| 582 configuration. | 582 configuration. |
| 583 | 583 |
| 584 It is possible to get a jailed configuration from an already jailed | |
| 585 configuration:: | |
| 586 | |
| 587 import configmix | |
| 588 | |
| 589 config = configmix.load("conf10.py") | |
| 590 value = config.getvar_s("tree1.tree2.key4") | |
| 591 | |
| 592 jailed_config1 = config.jailed(rootpath="tree1") | |
| 593 | |
| 594 jailed_config2 = jailed_config2.jailed(rootpath="tree2") | |
| 595 jvalue2 = jailed_config.getvarl_s("key4") | |
| 596 | |
| 597 assert value == jvalue2 == "get this as `tree1.tree2.key4'" | |
| 598 | |
| 584 | 599 |
| 585 Custom filename extensions and custom loaders | 600 Custom filename extensions and custom loaders |
| 586 --------------------------------------------- | 601 --------------------------------------------- |
| 587 | 602 |
| 588 If you want to have custom configuration file extensions and/or custom loaders | 603 If you want to have custom configuration file extensions and/or custom loaders |
