-
-
Notifications
You must be signed in to change notification settings - Fork 286
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
[bug] FlaskDynaconf breaks default getter of flask config #521
Labels
Comments
Not quite duplicate. #501 and #502 are about |
rochacbruno
added a commit
that referenced
this issue
Feb 26, 2021
rochacbruno
added a commit
that referenced
this issue
Feb 26, 2021
rochacbruno
added a commit
that referenced
this issue
Mar 1, 2021
Shortlog of commits since last release: Bruno Rocha (11): Release version 3.1.2 Fix #445 casting on dottet get. (#446) Fix docs regarding --django argument on cli (#477) Fix #521 - FlaskDynaconf should raise KeyError for non existing keys (#522) Case insensitive envvar traversal (#524) Allow load_file to accept pathlib.Path (#525) Allow Title case lookup and validation. (#526) Fix #482 - formatter case insensitive (#527) Fix #449 - Django lazy templating Fix #449 (#528) Added a test to reproduce #492 (not able to reproduce) (#530) Fix #511 allow user to specify loaders argument to execute_loaders (#531) FrankBattaglia (1): Specify flask extension initializers by entry point object reference (#456) Ilito Torquato (3): fix merging hyperlink to fix #454 (#458) Changed enabled_core_loaders elements to be upper case to fix #455 (#457) Fix doc secrets from vault #403 (#459) Marcelo Lino (1): Add __contains__ to Dynaconf (#502) Michal Odnous (1): Fix: Environment variables filtering #470 (#474) dependabot-preview[bot] (5): Bump mkdocs-material from 6.0.2 to 6.1.0 (#453) Bump mkdocs-git-revision-date-localized-plugin from 0.5.2 to 0.7.3 (#463) Bump mkdocs-material from 6.1.0 to 6.1.5 (#473) Bump mkdocs-versioning from 0.2.1 to 0.3.1 (#475) Bump mkdocs-material from 6.1.5 to 6.1.6 (#476) mirrorrim (1): Fix reading secret from Vault kv v2 (#483) (#487)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
In pure Flask config if you query config for nonexisting key you get
KeyError
exception.If use FlaskDynaconf if you query config for nonexisting key you get value
None
.Such differences break thirdparty libraries, which suppose that flask config will raise
KeyError
when queriing nonexisting key (for example,python-social-auth
: https://github.com/python-social-auth/social-core/blob/master/social_core/strategy.py#L45 which goes to https://github.com/python-social-auth/social-app-flask/blob/master/social_flask/strategy.py#L19)To Reproduce
Correct behavior:
will give you
Incorrect behavior:
will give you
Project structure
Config files
No config files used at allCode
1_no_dynaconf.py
2_dynaconf.py
Execution
used Python 3.8.5, Flask 1.1.2, dynaconf 3.1.2
Expected behavior
Queriing non existing key via
config[key]
should raiseKeyError
, not returningNone
.Environment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: