Regression detected [was] Case insensitive access of structures inside lists
See original GitHub issueDescribe the bug
When I access a Box that is stored in a BoxList the access becomes case sensitive. I know about DynaBox, but for some reason the list access returns a vanilla Box and not a DynaBox.
Background: I need to parse more or less complex data from the config (routing stuff) and enrich the data structures with defaults after parsing. Therefore I want to set change the settings from within code.
If something like this is out of scope for Dynaconf, could someone recommend an alternative approach? Maybe only store user provided routing settings and all the other general simple configs like logging level in Dynaconf and manage the routing config elsewhere?
To Reproduce Steps to reproduce the behavior:
- Run the following code placed in
tmp.py
with pytestpytest tmp.py
:
from dynaconf.vendor.box import BoxList, Box
from dynaconf.utils.boxing import DynaBox
def test_accessing_dynabox_inside_boxlist_inside_dynabox():
data = DynaBox({"nested": [{"deeper": "nest"}]})
assert data.nested[0].deeper == "nest"
assert data.NESTED[0].deeper == "nest"
with pytest.raises(BoxKeyError):
assert data.NESTED[0].DEEPER == "nest"
data = DynaBox({"nested": [DynaBox({"deeper": "nest"})]})
assert data.nested[0].deeper == "nest"
assert data.NESTED[0].deeper == "nest"
with pytest.raises(BoxKeyError):
assert data.NESTED[0].DEEPER == "nest"
Even though I am passing in a DynaBox it gets changed to a Box
Dynaconf 3.1.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (7 by maintainers)
Top GitHub Comments
Must be fixed in https://github.com/rochacbruno/dynaconf/releases/tag/3.1.4 please reopen if any more issue.
thanks 😃
@rochacbruno fixes it for me but just in case FYI I had to pass
--upgrade
to an existing installation: