Enhance BaseToggle with additional enabled/disabled toggle methods
Open
Nobody has claimed this yet.
good first issue
help wanted
- Dominant language
- Python
- Stars
- 6
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
Enhance BaseToggle with additional methods.
Add the following:
- is_disabled: Returns not
is_enabled. - is_toggled_on: Returns
is_enabled. - is_toggled_off: Returns not
is_enabled.
This should make a variety of conditions more readable when ENABLE_ or DISABLE_ are in the toggle name.
Example 1: is_disabled
# BEFORE: slightly less readable
not SOME_FEATURE_TOGGLE.is_enabled()
# AFTER: more clear
SOME_FEATURE_TOGGLE.is_disabled()
Example 2: is_toggled_off
# BEFORE: brain twister
not DISABLE_SOME_FEATURE.is_enabled()
# AFTER: more clear
DISABLE_SOME_FEATURE.is_toggled_off()
Notes:
- For a
DISABLE_FEATUREtoggle, the toggle is off when the feature is on, so we use_toggle_in the method nameis_toggled_offto clearly refer to the toggle and not the feature. - For docs, possibly add an “Other ways to check a toggle” (or something like that) after https://github.com/openedx/edx-toggles/blob/master/docs/how_to/implement_the_right_toggle_type.rst#accessing-toggles?
- Similar change is needed for CourseWaffleFlag in edx-platform, which is slightly different because it takes an argument for is_enabled.
Questions:
Is this in fact simpler to understand? Are there better options?- We've decided to move forward
Work required:
- https://github.com/openedx/edx-toggles/pull/293
- Update docs (see notes)
- Update CourseWaffleFlag in edx-platform (see notes).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in edx_toggles/toggles/internal/base.py and review the linked access-toggles documentation section. Check pull request 293 and the CourseWaffleFlag reference in edx-platform before starting. Done means the requested BaseToggle methods, documentation updates, and corresponding CourseWaffleFlag work are addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100