Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/config.py @ 711:6557cf9ecea5
FIX: When using attribute access for configurations the values are interpolated since long ago: fix the docu and add a test for that behaviour
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Tue, 15 Aug 2023 15:09:11 +0200 |
| parents | e692216f8756 |
| children | 8a28ff4ea59c |
comparison
equal
deleted
inserted
replaced
| 710:ff0de14493f1 | 711:6557cf9ecea5 |
|---|---|
| 472 class Configuration(CoercingMethodsMixin, _AttributeDict): | 472 class Configuration(CoercingMethodsMixin, _AttributeDict): |
| 473 | 473 |
| 474 """The configuration dictionary with attribute support or | 474 """The configuration dictionary with attribute support or |
| 475 variable substitution. | 475 variable substitution. |
| 476 | 476 |
| 477 .. note:: When retrieving by attribute names variables will *not* | 477 .. note:: When retrieving by attribute names variables will be |
| 478 substituted. | 478 interpolated. |
| 479 | 479 |
| 480 """ | 480 """ |
| 481 | 481 |
| 482 is_jail = False | 482 is_jail = False |
| 483 """Flag to show that this is not a jail for another configuration""" | 483 """Flag to show that this is not a jail for another configuration""" |
| 1021 stacklevel=1) | 1021 stacklevel=1) |
| 1022 raise KeyError("Cannot interpolate variables in string " | 1022 raise KeyError("Cannot interpolate variables in string " |
| 1023 "%r (cached)" % (s, )) | 1023 "%r (cached)" % (s, )) |
| 1024 else: | 1024 else: |
| 1025 return res | 1025 return res |
| 1026 | 1026 |
| 1027 if ((len_s >= 6) | 1027 if ((len_s >= 6) |
| 1028 and (s[2] == _FILTER_SEPARATOR) | 1028 and (s[2] == _FILTER_SEPARATOR) |
| 1029 and (start == 0)): | 1029 and (start == 0)): |
| 1030 if s.find(_ENDTOK_FILTER, 3) != (len_s - 3): | 1030 if s.find(_ENDTOK_FILTER, 3) != (len_s - 3): |
| 1031 raise ValueError("`{{|' global filter interpolation must end with `|}}'") | 1031 raise ValueError("`{{|' global filter interpolation must end with `|}}'") |
