-
-
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
Add __contains__ to Dynaconf #502
Conversation
Codecov Report
@@ Coverage Diff @@
## master #502 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 17 17
Lines 849 851 +2
=========================================
+ Hits 849 851 +2
Continue to review full report at Codecov.
|
dynaconf/base.py
Outdated
@@ -105,6 +105,9 @@ def __init__(self, **kwargs): | |||
self._kwargs = kwargs | |||
super(LazySettings, self).__init__() | |||
|
|||
def __contains__(self, item): | |||
return hasattr(self, item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dynaconf stores data in 2 places.
- self._store which is a dictionary
- as instance attributes
I am not sure if simply calling hasattr
will use __getattr__
which already makes the lookup in both places.
Also we might need to add some unit tests and a functional test in /example/ folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, i get it. I'll test this scenario and write some tests to validate this.
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)
No description provided.