Mercurial > hgrepos > Python > libs > ConfigMix
annotate doc/introduction.rst @ 145:d44ee758e31b
Some docu on comments in files
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Fri, 13 Apr 2018 21:44:42 +0200 |
| parents | fc2bd73f9e98 |
| children | ab6a48ff5235 |
| rev | line source |
|---|---|
| 94 | 1 .. -*- coding: utf-8; indent-tabs-mode: nil; -*- |
| 2 | |
| 3 .. _introduction: | |
| 4 | |
| 5 Introduction | |
| 6 ============ | |
| 7 | |
| 8 The configurations can be read from different types of files: | |
| 9 | |
| 10 - :ref:`YAML files <yaml-files>` | |
| 131 | 11 - :ref:`JSON files <json-files>` |
| 94 | 12 - :ref:`INI files <ini-files>` |
| 13 - :ref:`executable Python scripts <executable-python-scripts>` | |
| 14 | |
| 15 | |
| 16 .. _yaml-files: | |
| 17 | |
| 18 YAML Files | |
| 19 ---------- | |
| 20 | |
| 21 Need the :mod:`yaml` package (e.g. ``pip install pyyaml``) | |
| 22 | |
| 23 .. note:: All strings are returned as Unicode text strings. | |
| 24 | |
|
134
2f2e819e8d17
Check the return type of the JSON and YAML loading functions: they must be a dict alike
Franz Glasner <hg@dom66.de>
parents:
133
diff
changeset
|
25 .. note:: The root object must be a *mapping* and therefore decode |
|
2f2e819e8d17
Check the return type of the JSON and YAML loading functions: they must be a dict alike
Franz Glasner <hg@dom66.de>
parents:
133
diff
changeset
|
26 into a Python :class:`dict` alike. This is checked by the |
|
2f2e819e8d17
Check the return type of the JSON and YAML loading functions: they must be a dict alike
Franz Glasner <hg@dom66.de>
parents:
133
diff
changeset
|
27 implementation. |
| 94 | 28 |
|
97
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
29 An example is: |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
30 |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
31 .. literalinclude:: ../tests/data/conf10.yml |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
32 :language: yaml |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
33 |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
34 |
|
122
21d92ff8cf31
Begin the handling of JSON-style configuration files
Franz Glasner <hg@dom66.de>
parents:
117
diff
changeset
|
35 .. _json-files: |
|
21d92ff8cf31
Begin the handling of JSON-style configuration files
Franz Glasner <hg@dom66.de>
parents:
117
diff
changeset
|
36 |
|
21d92ff8cf31
Begin the handling of JSON-style configuration files
Franz Glasner <hg@dom66.de>
parents:
117
diff
changeset
|
37 JSON files |
|
21d92ff8cf31
Begin the handling of JSON-style configuration files
Franz Glasner <hg@dom66.de>
parents:
117
diff
changeset
|
38 ---------- |
|
21d92ff8cf31
Begin the handling of JSON-style configuration files
Franz Glasner <hg@dom66.de>
parents:
117
diff
changeset
|
39 |
| 131 | 40 Read the JSON file with the help of Python's native :mod:`json` package. |
| 41 | |
| 42 .. note:: All strings are returned as Unicode text strings. | |
| 43 | |
|
134
2f2e819e8d17
Check the return type of the JSON and YAML loading functions: they must be a dict alike
Franz Glasner <hg@dom66.de>
parents:
133
diff
changeset
|
44 .. note:: The root object must be an *object* and therefore decode |
|
2f2e819e8d17
Check the return type of the JSON and YAML loading functions: they must be a dict alike
Franz Glasner <hg@dom66.de>
parents:
133
diff
changeset
|
45 into a Python :class:`dict` alike. This is checked by the |
|
2f2e819e8d17
Check the return type of the JSON and YAML loading functions: they must be a dict alike
Franz Glasner <hg@dom66.de>
parents:
133
diff
changeset
|
46 implementation. |
| 131 | 47 |
| 48 An example is: | |
| 49 | |
| 50 .. literalinclude:: ../tests/data/conf10.json | |
| 51 :language: js | |
|
122
21d92ff8cf31
Begin the handling of JSON-style configuration files
Franz Glasner <hg@dom66.de>
parents:
117
diff
changeset
|
52 |
| 145 | 53 For comments in JSON files see section :ref:`comments`. |
| 54 | |
|
122
21d92ff8cf31
Begin the handling of JSON-style configuration files
Franz Glasner <hg@dom66.de>
parents:
117
diff
changeset
|
55 |
| 94 | 56 .. _ini-files: |
| 57 | |
| 58 INI Files | |
| 59 --------- | |
| 60 | |
| 61 Read the file and all sections named in parameter `extract` are flattened | |
| 62 into the resulting dictionary. By default the section named ``config`` is | |
| 63 used. | |
| 64 | |
| 65 Normally all values are returned as Unicode text strings. | |
| 66 But values can be annotated and therefore interpreted as other types: | |
| 67 | |
| 68 ``:int:`` | |
| 69 The value is handled in the same way as a Python :class:`int` | |
| 70 literal | |
| 71 | |
| 72 ``:float:`` | |
| 73 The value is interpreted as :class:`float` | |
| 74 | |
| 75 ``:bool:`` | |
| 76 The resulting value is a :class:`bool` where | |
| 77 | |
| 78 ``1``, ``true``, ``yes``, ``on`` | |
| 79 yield a Python ``True`` | |
| 80 | |
| 81 ``0``, ``false``, ``no``, ``off`` | |
| 82 yield a Python ``False`` | |
| 83 | |
| 84 The evaluation is done *case-insensitively*. | |
| 85 | |
| 86 .. note:: All strings are returned as Unicode text strings. | |
| 87 | |
| 88 .. note:: Contrary to the behaviour of the standard Python :mod:`configparser` | |
| 89 module the INI file reader is *case-sensitive*. | |
| 90 | |
|
97
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
91 The example INI style configuration below yields an equivalent |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
92 configuration to the YAML configuration above: |
| 94 | 93 |
|
97
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
94 .. literalinclude:: ../tests/data/conf10.ini |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
95 :language: ini |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
96 |
| 133 | 97 As can be seen in this example -- INI file internal value interpolation |
|
97
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
98 is done as in Python's standard :mod:`configparser` module. |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
99 |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
100 This example also illustrates how INI sections are used to build a |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
101 tree-ish configuration dictionary. |
| 94 | 102 |
| 103 | |
| 104 .. _executable-python-scripts: | |
| 105 | |
| 106 Executable Python Scripts | |
| 107 ------------------------- | |
| 108 | |
| 109 What will be exported: | |
| 110 | |
| 111 1. If loading is done with the `extract` parameter only the given keys are | |
| 112 extracted from the script. | |
| 113 | |
| 114 2. Otherwise it is checked if the scripts defines an ``__all__`` | |
| 115 sequence. If there is one it's contents are the keys to be | |
| 116 extracted. | |
| 117 | |
| 118 3. If there is no ``__all__`` object all names not starting with an | |
| 119 underscore ``_`` are found. | |
| 120 | |
| 121 This is analogous to as Python modules behave when importing them with | |
| 122 ``from module import *``. | |
| 123 | |
| 124 .. note:: The Python configuration files are evaluated with ``exec`` and not | |
| 125 imported. | |
|
97
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
126 |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
127 The example configuration by Python script below yields an equivalent |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
128 configuration to the YAML configuration above: |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
129 |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
130 .. literalinclude:: ../tests/data/conf10.py |
|
1b4d95f60650
Build a tree-ish configuration from an INI style configuration file
Franz Glasner <hg@dom66.de>
parents:
94
diff
changeset
|
131 :language: python |
|
114
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
132 |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
133 |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
134 .. _loading-and-merging: |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
135 |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
136 Loading and Merging |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
137 ------------------- |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
138 |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
139 Basic usage of the API is as follows in this example:: |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
140 |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
141 import configmix |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
142 |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
143 # |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
144 # Note: With conf10 merging is rather pointless because the tree |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
145 # files # are really the same configuration. But is doesn't harm |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
146 # also here. |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
147 # |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
148 config = configmix.load("conf10.yml", "conf10.ini", "conf10.py") |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
149 |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
150 # Get a -- possibly interpolated -- configuration variable's value |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
151 value1 = config.getvar_s("key1") |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
152 |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
153 # Get a -- possibly interpolated -- variable from within the tree |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
154 value2 = config.getvar_s("tree1.tree2.key4") |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
155 |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
156 |
|
139
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
157 By default filenames of the configuration files must have the extensions |
|
114
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
158 (case-insensitively): |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
159 |
|
142
fc2bd73f9e98
Sort extension list in the docu
Franz Glasner <hg@dom66.de>
parents:
139
diff
changeset
|
160 ``.ini`` |
|
fc2bd73f9e98
Sort extension list in the docu
Franz Glasner <hg@dom66.de>
parents:
139
diff
changeset
|
161 for INI configuration files |
|
fc2bd73f9e98
Sort extension list in the docu
Franz Glasner <hg@dom66.de>
parents:
139
diff
changeset
|
162 |
|
fc2bd73f9e98
Sort extension list in the docu
Franz Glasner <hg@dom66.de>
parents:
139
diff
changeset
|
163 ``.json`` |
|
fc2bd73f9e98
Sort extension list in the docu
Franz Glasner <hg@dom66.de>
parents:
139
diff
changeset
|
164 for JSON configuration files |
|
fc2bd73f9e98
Sort extension list in the docu
Franz Glasner <hg@dom66.de>
parents:
139
diff
changeset
|
165 |
|
114
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
166 ``.py`` |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
167 for Python configuration files |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
168 |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
169 ``.yml`` or ``.yaml`` |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
170 for YAML configuration files |
|
aa0c61e79660
Add a documentation section about basic API usage: loading (and merging)
Franz Glasner <hg@dom66.de>
parents:
97
diff
changeset
|
171 |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
172 |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
173 .. _getting-values: |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
174 |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
175 Getting configuration variables |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
176 ------------------------------- |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
177 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
178 Get a -- possibly expanded -- configuration variable's value with:: |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
179 |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
180 value1 = config.getvar_s("key1") |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
181 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
182 Get a raw configuration variable's value with:: |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
183 |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
184 value1_raw = config.getvar("key1") |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
185 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
186 Because the configuration is not only a plain list of but a tree of |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
187 key-value pairs you will want to fetch them by separating the individual |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
188 level keys with a point ``.``. |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
189 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
190 Looking at the example in chapter :ref:`yaml-files` -- when calling |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
191 ``config.getvar_s("tree1.tree2.key4")`` you will get the value |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
192 ``get this as `tree1.tree2.key4'``. |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
193 |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
194 This is true for both methods :py:meth:`.Configuration.getvar` and |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
195 :py:meth:`.Configuration.getvar_s`. |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
196 |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
197 Both methods also perform :ref:`variable-expansion` and handle |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
198 :ref:`variable-namespaces`. Filtering is not supported. So -- the |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
199 variable name arguments of :py:meth:`.Configuration.getvar` and |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
200 :py:meth:`.Configuration.getvar_s` are of the form |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
201 ``[namespace:]variable``. |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
202 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
203 |
| 145 | 204 .. _comments: |
| 205 | |
| 206 Comments | |
| 207 -------- | |
| 208 | |
| 209 By default all keys beginning with ``__comment`` or ``__doc`` are | |
| 210 filtered out and not given to the application. This allows comments in | |
| 211 JSON files -- but is not restricted to JSON files only. | |
| 212 | |
| 213 For all types of configuration files their respective standard comments | |
| 214 are allowed too. | |
| 215 | |
| 216 | |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
217 .. _variable-namespaces: |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
218 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
219 Variable Namespaces |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
220 ------------------- |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
221 |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
222 Currently there are 4 namespaces: |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
223 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
224 1. The unnamed namespace (which is also default). |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
225 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
226 All the configuration variables are part of this namespace. |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
227 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
228 2. The namespace ``OS`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
229 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
230 Available functions: |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
231 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
232 ``cwd`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
233 Contains the current working directory of the process |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
234 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
235 3. The namespace ``ENV`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
236 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
237 This namespace contains all the environment variables as they are |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
238 available from :py:data:`os.environ`. |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
239 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
240 4. The namespace ``PY`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
241 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
242 Contains selected values from the running Python: |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
243 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
244 ``version`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
245 The return value of :py:func:`platform.python_version` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
246 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
247 ``version_maj_min`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
248 Just the major and minor version of the running Python |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
249 (``.`` separated) |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
250 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
251 ``version_maj`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
252 Just the major version of the running Python |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
253 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
254 ``implementation`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
255 The return value of :py:func:`platform.python_implementation` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
256 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
257 |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
258 Examples |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
259 ~~~~~~~~ |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
260 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
261 :: |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
262 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
263 config.getvar("OS:cwd") |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
264 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
265 yields the current working directory as :py:func:`os.getcwd` does. |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
266 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
267 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
268 .. _variable-expansion: |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
269 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
270 Variable Expansion |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
271 ------------------ |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
272 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
273 Configuration variable values that are read with |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
274 :py:meth:`.Configuration.getvar_s` are subject to variable |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
275 expansion. The general syntactic pattern for this is:: |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
276 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
277 {{[namespace:]variable[|filter[|filter...]]}} |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
278 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
279 I.e.: between double curly braces an optional `namespace` name followed by |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
280 a colon ``:``, the `variable` and then zero or more filters, each one |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
281 introduced by a pipe symbol ``|``. |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
282 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
283 Variables are expanded lately at runtime -- exactly when calling |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
284 :py:meth:`.Configuration.getvar_s` or :py:meth:`.Configuration.getvar`. |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
285 |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
286 |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
287 Filter functions |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
288 ~~~~~~~~~~~~~~~~ |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
289 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
290 Interpolated values can be processed through a series of filter functions:: |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
291 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
292 {{my.variable|filter1|filter2}} |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
293 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
294 Available filter functions are: |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
295 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
296 ``urlquote`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
297 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
298 ``saslprep`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
299 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
300 ``normpath`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
301 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
302 ``abspath`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
303 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
304 ``posixpath`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
305 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
306 ``lower`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
307 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
308 ``upper`` |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
309 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
310 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
311 Examples |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
312 ~~~~~~~~ |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
313 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
314 :: |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
315 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
316 {{OS:cwd|posixpath}} |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
317 |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
318 expands to the current working directory as POSIX path: on Windows all |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
319 backslashes are replaced by forward slashes. |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
320 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
321 :: |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
322 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
323 {{ENV:PATH}} |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
324 |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
325 expands to the current search path from the process environment. |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
326 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
327 :: |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
328 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
329 {{PY:version}} |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
330 |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
331 expands to the current running Python version (e.g. ``3.6.4``). |
|
115
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
332 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
333 :: |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
334 |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
335 {{PY::implementation|upper}} |
|
a5339d39af5c
Begin the documentation of variables and its expansion
Franz Glasner <hg@dom66.de>
parents:
114
diff
changeset
|
336 |
|
117
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
337 expands to something like ``CPYTHON`` when using the standard Python |
|
c5b638f9c607
- More on getting variable values
Franz Glasner <hg@dom66.de>
parents:
115
diff
changeset
|
338 interpreter written in C. |
|
139
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
339 |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
340 |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
341 Custom filename extensions and custom loaders |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
342 --------------------------------------------- |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
343 |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
344 If you want to have custom configuration file extensions and/or custom loaders |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
345 for custom configuration files you have various possibilities: |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
346 |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
347 Associate an additional new extension (e.g. ".conf") with an |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
348 existing configuration file style (e.g. YAML):: |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
349 |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
350 configmix.set_loader(".conf", configmix.default_loaders[".yml"]) |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
351 |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
352 Allow only files with extension ".cfg" in INI-style:: |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
353 |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
354 configmix.clear_loader() |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
355 configmix.set_loader(".cfg", configmix.default_loders[".ini"]) |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
356 |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
357 Just a new configuration file style:: |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
358 |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
359 def my_custom_loader(filename): |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
360 ... |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
361 return some_dict_alike |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
362 |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
363 configmix.clear_loader() |
|
c87b0dc54e1d
Allow custom configuration filename extensions and custom loaders that can handle custom configuration file syntax styles
Franz Glasner <hg@dom66.de>
parents:
134
diff
changeset
|
364 configmix.set_loader(".my.configuration", my_custom_loader) |
