[BD-21] Extract waffle_utils from edx-platform - #70
Conversation
|
Thanks for the pull request, @regisb! I've created BLENDED-617 to keep track of it in Jira. More details are on the BD-21 project page. When this pull request is ready, tag your edX technical lead. |
235927f to
a41e337
Compare
robrap
left a comment
There was a problem hiding this comment.
I'm going to wait on further review.
robrap
left a comment
There was a problem hiding this comment.
I added a couple of additional high-level comments. Thanks!
d211fa6 to
e5796a6
Compare
|
@robrap I expect that the suppression of the namespace classes is going to be tedious, but not otherwise complex. So I propose that we resolve the extraction of the waffle and switch classes first. I will then open a new PR to get rid of the many namespace instances. Otherwise we will end up with a PR that touches upon dozens of files, which is inconvenient to review. |
2390052 to
acb0bba
Compare
ec83e96 to
190c219
Compare
|
@robrap This should now be ready to review. |
f54692c to
6a5d3c3
Compare
| def _get_flag_active_default(self, namespaced_flag_name): | ||
| """ | ||
| Return default value in the absence of any other, more specific flag value. |
There was a problem hiding this comment.
This name and docstring don't really match the implementation, which includes lots of warnings, because this is an exceptional case. What about _get_flag_active_for_missing_request or _get_flag_active_default_for_missing_request?
There was a problem hiding this comment.
I'll go with _get_flag_active_no_request to be consistent with the naming of the _get_flag_active_request method.
6a5d3c3 to
999ead8
Compare
Otherwise this contradicts edx-platform's requirements
Otherwise the edx-platform root url is overridden, too... This took me a long while to figure it out...
This is necessary to get the flag value in the current request context.
This will be necessary for caching and monitoring.
For now, we keep the namespace classes, but they are meant to go soon.
The constructor was missing the `module_name` argument.
`tox -e pii_check` was failing with the following error:
Coverage found 3 uncovered models:
waffle.Flag
waffle.Sample
waffle.Switch
We mark these models as safe to pass the pii_check test.
The class attribute `_cached_value` was never being used. Instead, `self._cached_value` was creating an instance-level attribute. So we just get rid of the class attribute.
As these features are destined to be removed, we should not make them available in the edx-toggles shared package.
This simplifies the API, notably for tests which no longer have to manually call the `_get_waffle_flag_custom_attributes_set.clear_cache` function before each test. Instead, the WAFFLE_FLAG_CUSTOM_ATTRIBUTES setting should be a set. Lists are also supported, although they might be slightly less performant, dependending on the number of custom attributes.
* Fix ``SettingDictToggle`` constructor. * Extract waffle classes from edx-platform and move them here. * Fix pinned requirements and incorrect root url that overrode edx-platform's.
999ead8 to
4f690e6
Compare
robrap
left a comment
There was a problem hiding this comment.
We will follow-up with cleaning out namespacing in a following PR.
Description: Extract the various waffle switch/flag classes from edx-platform such that they can be used in other IDAs. This implements ADR
#2 <https://github.com/edx/edx-toggles/tree/master/docs/decisions/0002-application-toggle-state.rst>,#3 <https://github.com/edx/edx-toggles/tree/master/docs/decisions/0003-django-setting-toggles.rst>,#4 <https://github.com/edx/edx-toggles/tree/master/docs/decisions/0004-toggle-api.rst>__. These changes are backward-compatible. Suppression of the namespace classes will happen in a separate PR.JIRA: https://openedx.atlassian.net/wiki/spaces/COMM/pages/1596358943?src=mail&src.mail.timestamp=1593719976942
Reviewers:
Merge checklist:
Post merge:
finished.
This is a work in progress. A couple things still need to be done: