question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression detected [was] Case insensitive access of structures inside lists

See original GitHub issue

Describe 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:

  1. Run the following code placed in tmp.py with pytest pytest 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:closed
  • Created 3 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rochacbrunocommented, Mar 8, 2021

Must be fixed in https://github.com/rochacbruno/dynaconf/releases/tag/3.1.4 please reopen if any more issue.

thanks 😃

0reactions
dmsimardcommented, Mar 8, 2021

@rochacbruno fixes it for me but just in case FYI I had to pass --upgrade to an existing installation:

/tmp/ara/bin/pip install https://github.com/rochacbruno/dynaconf/tarball/462.b
Collecting https://github.com/rochacbruno/dynaconf/tarball/462.b
  Downloading https://github.com/rochacbruno/dynaconf/tarball/462.b
     | 2.7 MB 781 kB/s
Requirement already satisfied (use --upgrade to upgrade): dynaconf==3.1.3 from https://github.com/rochacbruno/dynaconf/tarball/462.b in /tmp/ara/lib/python3.9/site-packages
Read more comments on GitHub >

github_iconTop Results From Across the Web

Regression detected [was] Case insensitive access of ...
When I access a Box that is stored in a BoxList the access becomes case sensitive. I know about DynaBox, but for some...
Read more >
A brand new website interface for an even better experience!
Regression detected [was] Case insensitive access of structures inside lists.
Read more >
Is Access case sensitive with regard to look-up type lists
I have a list of all the variants I have found and have matched against the standard names (E.g., column FieldName1: variant spellings, ......
Read more >
Fix List for Sterling B2B Integrator V6.1.0.0
This page contains comprehensive fix information for all Fix Packs released for Sterling B2B Integrator and Sterling File Gateway V6.1.0.0 and later ...
Read more >
c# - What data structure should I use for a double binding ...
1 Answer 1 ... Two suggestions: List is backed by an array, so you could take advantage of random access. Instead of supplying...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found