Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make
conf.set
case insensitive (#33452)
* make `conf.set` case insensitive `conf.get` is insensitive (it converts section and key to lower case) but set is not, which can lead to surprising behavior (see the test, which is not passing without the fix). I suggest that we override set as well to fix that. Any value that was set before with upper case was unreacheable. * fix remove_option as well * away with the str() * add significant change newsfragment
- Loading branch information
1 parent
39b13ec
commit abbd567
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
``conf.set()`` becomes case insensitive to match ``conf.get()`` behavior. Also, ``conf.get()`` will now break if used with non-string parameters. | ||
|
||
``conf.set(section, key, value)`` used to be case sensitive, i.e. ``conf.set("SECTION", "KEY", value)`` | ||
and ``conf.set("section", "key", value)`` were stored as two distinct configurations. | ||
This was inconsistent with the behavior of ``conf.get(section, key)``, which was always converting the section and key to lower case. | ||
|
||
As a result, configuration options set with upper case characters in the section or key were unreachable. | ||
That's why we are now converting section and key to lower case in ``conf.set`` too. | ||
|
||
We also changed a bit the behavior of ``conf.get()``. It used to allow objects that are not strings in the section or key. | ||
Doing this will now result in an exception. For instance, ``conf.get("section", 123)`` needs to be replaced with ``conf.get("section", "123")``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters