This is a first stage for removing the LegacyWaffle* classes. LegacyWaffleFlag usage replaced with WaffleFlag; LegacyWaffleSwitche usage replaced with WaffleSwitch; New CourseWaffleFlag added to the temporary module __future__ as FutureCourseWaffleFlag; Updated all the imports to use CourseWaffleFlag from the __future__ module; BREAKING CHANGE: A number of toggle related constants (e.g. ENABLE_ACCESSIBILITY_POLICY_PAGE) changed types. They were strings, and are now toggle instances (e.g. WaffleSwitch). Although the entire refactor should be self-contained in edx-platform, if any plugins or dependencies were directly using these constants, they will break. If this is the case, try to find a better publicized way of exposing those toggles.
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
"""
|
|
Toggles for Learner Profile page.
|
|
"""
|
|
|
|
|
|
from edx_toggles.toggles import WaffleFlag
|
|
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
|
|
|
# Namespace for learner profile waffle flags.
|
|
WAFFLE_FLAG_NAMESPACE = 'learner_profile'
|
|
|
|
# Waffle flag to redirect to another learner profile experience.
|
|
# .. toggle_name: learner_profile.redirect_to_microfrontend
|
|
# .. toggle_implementation: WaffleFlag
|
|
# .. toggle_default: False
|
|
# .. toggle_description: Supports staged rollout of a new micro-frontend-based implementation of the profile page.
|
|
# .. toggle_use_cases: temporary, open_edx
|
|
# .. toggle_creation_date: 2019-02-19
|
|
# .. toggle_target_removal_date: 2020-12-31
|
|
# .. toggle_warnings: Also set settings.PROFILE_MICROFRONTEND_URL and site's ENABLE_PROFILE_MICROFRONTEND.
|
|
# .. toggle_tickets: DEPR-17
|
|
REDIRECT_TO_PROFILE_MICROFRONTEND = WaffleFlag(f'{WAFFLE_FLAG_NAMESPACE}.redirect_to_microfrontend', __name__)
|
|
|
|
|
|
def should_redirect_to_profile_microfrontend():
|
|
return (
|
|
configuration_helpers.get_value('ENABLE_PROFILE_MICROFRONTEND') and
|
|
REDIRECT_TO_PROFILE_MICROFRONTEND.is_enabled()
|
|
)
|