-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String interpolation of values that aren't strings + validation #129
Comments
After template injection, the same coercion like after parsing should be applied, I guess. |
I am running into a similar issue where I have a list of strings assigned to one item that I would like to have it interpolated into another entry. I can devote some resources to fixing this (I need this feature for a project at work). If you point me in the right direction, I'll see what I can do for this. |
Ok, I see a real quick and easy solution, but it does have some peculiarities:
So, if you have a config like so:
you get |
Ah-ha! If I refactor the |
yeah, the more I think about this, the more I like the solution. I'll put together a PR with this solution along with unit tests tomorrow. |
optimistically putting this in 5.1.0 hoping that #169 helps me get my arms around it |
I want to use a value that isn't a string from one option in another option, and validate both options.
Example
config.ini:
configspec.ini:
main.py:
Expected outcome:
Actual outcome:
Changing
total_cores = integer
tototal_cores = string
solves the issue, but gives the wrong type forconfig['section']['total_cores']
.I don't know the code well, but I would expect it to call
str()
on the value oftotal_cores
(i.e.,1
) before attempting to use it in the string interpolation ofcores_app1
.Tested with both default and Template string interpolation with ConfigObj 5.0.6 and Python 2.7.9, 2.7.11, and 3.5.1.
The text was updated successfully, but these errors were encountered: