Skip to content
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

fix: check None before returning config #296

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Unreleased

* Switch from ``edx-sphinx-theme`` to ``sphinx-book-theme`` since the former is
deprecated
* Fixed ConfigurationModel.current: it will make sure that it does not return None for current configuration.

[2.3.0] - 2022-01-19
~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion config_models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def current(cls, *args):
"""
cache_key = cls.cache_key_name(*args)
cached_response = TieredCache.get_cached_response(cache_key)
if cached_response.is_found:
if cached_response.is_found and cached_response.value is not None:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[inform] The None check was there before at this place. But it was removed when TieredCache was included.

https://github.com/openedx/django-config-models/pull/55/files#diff-89972c71903f4383220fc6ece46180b9c5c52f3467b07de6cc662ae9a546f49aL199-L201

return cached_response.value

key_dict = dict(zip(cls.KEY_FIELDS, args))
Expand Down