docs: update toggle docs

A variety of updates were made to improve the toggle documentation:
* Added comments to help ensure that the waffle(), waffle_switches(),
  waffle_flags() anti-pattern won't be contagious (copied).
* Some minor toggle_description updates.
* Removed empty toggle_target_removal_date annotations for
  non-temporary toggles.
* Removed empty optional toggle_warnings annotations.
* Removed empty optional toggle_tickets annotations.
* Removed deprecated toggle_category, toggle_status,
  and toggle_expiration_date annotations.
* Fixed some indents, use cases, and implementations.

ARCHBOM-1721
This commit is contained in:
Robert Raposa
2021-04-01 21:58:29 -04:00
parent 16634f9cab
commit 8ef8b35a54
25 changed files with 77 additions and 152 deletions

View File

@@ -10,11 +10,18 @@ from edx_toggles.toggles import LegacyWaffleSwitchNamespace
WAFFLE_NAMESPACE = 'certificates'
# Switches
# TODO: Replace with WaffleSwitch(). See waffle() docstring.
AUTO_CERTIFICATE_GENERATION = 'auto_certificate_generation'
def waffle():
"""
Returns the namespaced, cached, audited Waffle class for Certificates.
IMPORTANT: Do NOT copy this pattern and do NOT use this to reference new switches.
Instead, replace the string constant above with the actual switch instance.
For example::
AUTO_CERTIFICATE_GENERATION = WaffleSwitch(f'{WAFFLE_NAMESPACE}.auto_certificate_generation')
"""
return LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix='Certificates: ')

View File

@@ -12,13 +12,10 @@ from openedx.core.djangoapps.theming.helpers import get_current_request
# .. toggle_name: ENABLE_REQUIRE_THIRD_PARTY_AUTH
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: Set to True to prevent using username/password login and registration and only allow authentication with third party auth
# .. toggle_category: admin
# .. toggle_description: Set to True to prevent using username/password login and registration and only allow
# authentication with third party auth
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2020-09-16
# .. toggle_expiration_date: None
# .. toggle_tickets: None
# .. toggle_status: supported
# .. toggle_warnings: Requires configuration of third party auth
@@ -29,7 +26,8 @@ def is_require_third_party_auth_enabled():
# .. toggle_name: user_authn.redirect_to_microfrontend
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
# .. toggle_description: Supports staged rollout of a new micro-frontend-based implementation of the login and registration pages
# .. toggle_description: Supports staged rollout of a new micro-frontend-based implementation of the login and
# registration pages
# .. toggle_use_cases: temporary, open_edx
# .. toggle_creation_date: 2021-02-02
# .. toggle_target_removal_date: None

View File

@@ -105,7 +105,6 @@ REGISTER_USER = Signal(providing_args=["user", "registration"])
# .. toggle_creation_date: 2020-04-30
# .. toggle_target_removal_date: 2020-06-01
# .. toggle_warnings: This temporary feature toggle does not have a target removal date.
# .. toggle_tickets: None
REGISTRATION_FAILURE_LOGGING_FLAG = LegacyWaffleFlag(
waffle_namespace=LegacyWaffleFlagNamespace(name=u'registration'),
flag_name=u'enable_failure_logging',

View File

@@ -30,8 +30,6 @@ class HLSPlaybackEnabledFlag(ConfigurationModel):
.. toggle_description: Add the "hls" profile to all displayed videos on the platform.
.. toggle_use_cases: open_edx
.. toggle_creation_date: 2017-04-19
.. toggle_target_removal_date: None
.. toggle_warnings: None
.. toggle_tickets: https://github.com/edx/edx-platform/pull/14924
"""
# this field overrides course-specific settings
@@ -82,8 +80,6 @@ class CourseHLSPlaybackEnabledFlag(ConfigurationModel):
.. toggle_description: Add the "hls" profile to all displayed videos for a single course.
.. toggle_use_cases: open_edx
.. toggle_creation_date: 2017-04-19
.. toggle_target_removal_date: None
.. toggle_warnings: None
.. toggle_tickets: https://github.com/edx/edx-platform/pull/14924
"""
KEY_FIELDS = ('course_id',)

View File

@@ -10,15 +10,14 @@ from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
WAFFLE_NAMESPACE = 'videos'
# .. toggle_name: videos.deprecate_youtube
# .. toggle_implementation: WaffleFlag
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_default: False
# .. toggle_description: Waffle flag telling whether youtube is deprecated. When enabled, videos are no longer uploaded
# to YouTube as part of the video pipeline.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2018-08-03
# .. toggle_target_removal_date: None
# .. toggle_warnings: None
# .. toggle_tickets: https://github.com/edx/edx-platform/pull/18765
# TODO: Replace with CourseWaffleFlag() from waffle_flags().
DEPRECATE_YOUTUBE = 'deprecate_youtube'
# .. toggle_name: videos.enable_devstack_video_uploads
# .. toggle_implementation: WaffleFlag
@@ -28,17 +27,21 @@ DEPRECATE_YOUTUBE = 'deprecate_youtube'
# of enabling this feature toggle are uncertain.]
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2020-03-12
# .. toggle_target_removal_date: None
# .. toggle_warnings: Enabling this feature requires that the ROLE_ARN, MFA_SERIAL_NUMBER, MFA_TOKEN settings are
# properly defined.
# .. toggle_tickets: https://github.com/edx/edx-platform/pull/23375
# TODO: Replace with WaffleFlag() from waffle_flags().
ENABLE_DEVSTACK_VIDEO_UPLOADS = 'enable_devstack_video_uploads'
# TODO: Replace with CourseWaffleFlag() from waffle_flags().
ENABLE_VEM_PIPELINE = 'enable_vem_pipeline'
def waffle_flags():
"""
Returns the namespaced, cached, audited Waffle flags dictionary for Videos.
IMPORTANT: Do NOT copy this dict pattern and do NOT add new flags to this dict.
Instead, replace the string constants above with the actual flag instances.
"""
namespace = LegacyWaffleFlagNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Videos: ')
return {

View File

@@ -24,8 +24,6 @@ class VEMPipelineIntegration(ConfigurationModel):
video pipeline.
.. toggle_use_cases: open_edx
.. toggle_creation_date: 2020-06-04
.. toggle_target_removal_date: None
.. toggle_warnings: None
.. toggle_tickets: https://github.com/edx/edx-platform/pull/24093
"""
client_name = models.CharField(
@@ -68,8 +66,6 @@ class VideoUploadsEnabledByDefault(ConfigurationModel):
enables the "Video Uploads" menu in the CMS.
.. toggle_use_cases: open_edx
.. toggle_creation_date: 2017-11-10
.. toggle_target_removal_date: None
.. toggle_warnings: None
.. toggle_tickets: https://github.com/edx/edx-platform/pull/16536
"""
# this field overrides course-specific settings
@@ -121,8 +117,6 @@ class CourseVideoUploadsEnabledByDefault(ConfigurationModel):
"Video Uploads" menu in the CMS.
.. toggle_use_cases: open_edx
.. toggle_creation_date: 2017-11-10
.. toggle_target_removal_date: None
.. toggle_warnings: None
.. toggle_tickets: https://github.com/edx/edx-platform/pull/16536
"""
KEY_FIELDS = ('course_id',)

View File

@@ -11,8 +11,6 @@ from edx_toggles.toggles import SettingDictToggle
# of the course.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2015-12-01
# .. toggle_target_removal_date: None
# .. toggle_warnings: None
# .. toggle_tickets: https://openedx.atlassian.net/browse/SOL-40
ENTRANCE_EXAMS = SettingDictToggle(
"FEATURES", "ENTRANCE_EXAMS", default=False, module_name=__name__

View File

@@ -27,9 +27,6 @@ class CourseDurationLimitConfig(StackedConfigurationModel):
"enabled_as_of" flag: only enrollments created after this date will be affected.
.. toggle_use_cases: opt_in
.. toggle_creation_date: 2018-11-02
.. toggle_target_removal_date: None
.. toggle_warnings: None
.. toggle_tickets: None
"""
STACKABLE_FIELDS = ('enabled', 'enabled_as_of')

View File

@@ -32,7 +32,6 @@ DISPLAY_COURSE_SOCK_FLAG = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'display_cour
# Waffle flag to let learners access a course before its start date.
COURSE_PRE_START_ACCESS_FLAG = LegacyWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'pre_start_access', __name__)
# Waffle flag to enable the setting of course goals.
# .. toggle_name: course_experience.enable_course_goals
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_default: False
@@ -41,7 +40,6 @@ COURSE_PRE_START_ACCESS_FLAG = LegacyWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'pre_star
# .. toggle_creation_date: 2017-09-11
# .. toggle_target_removal_date: None
# .. toggle_warnings: This temporary feature toggle does not have a target removal date.
# .. toggle_tickets: None
ENABLE_COURSE_GOALS = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'enable_course_goals', __name__)
# Waffle flag to control the display of the hero
@@ -50,18 +48,16 @@ SHOW_UPGRADE_MSG_ON_COURSE_HOME = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'show_
# Waffle flag to control the display of the upgrade deadline message
UPGRADE_DEADLINE_MESSAGE = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'upgrade_deadline_message', __name__)
# Waffle flag to switch between the 'welcome message' and 'latest update' on the course home page.
# .. toggle_name: course_experience.latest_update
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_default: False
# .. toggle_description: Used to switch between 'welcome message' and 'latest update' on the course home page.
# .. toggle_use_cases: opt_out
# .. toggle_use_cases: opt_out, temporary
# .. toggle_creation_date: 2017-09-11
# .. toggle_target_removal_date: None
# .. toggle_warnings: This is meant to be configured using waffle_utils course override only. Either do not create the
# actual waffle flag, or be sure to unset the flag even for Superusers. This is no longer used in the learning MFE
# and can be removed when the outline tab is fully moved to the learning MFE.
# .. toggle_tickets: None
LATEST_UPDATE_FLAG = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'latest_update', __name__)
# Waffle flag to enable anonymous access to a course

View File

@@ -10,19 +10,23 @@ WAFFLE_NAMESPACE = u'course_experience'
# Switches
# .. toggle_name: course_experience.enable_about_sidebar_html
# .. toggle_implementation: CourseWaffleFlag
# .. toggle_implementation: WaffleSwitch
# .. toggle_default: False
# .. toggle_description: Used to determine whether to show custom HTML in the sidebar on the internal course about page.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2018-01-26
# .. toggle_target_removal_date: None
# .. toggle_warnings: None
# .. toggle_tickets: None
# TODO: Replace with WaffleSwitch(). See waffle() docstring.
ENABLE_COURSE_ABOUT_SIDEBAR_HTML = u'enable_about_sidebar_html'
def waffle():
"""
Returns the namespaced, cached, audited shared Waffle Switch class.
Deprecated: Returns the namespaced, cached, audited shared Waffle Switch class.
IMPORTANT: Do NOT copy this pattern and do NOT use this to reference new switches.
Instead, replace the string constant above with the actual switch instance.
For example::
ENABLE_COURSE_ABOUT_SIDEBAR_HTML = WaffleSwitch(f'{WAFFLE_NAMESPACE}.enable_about_sidebar_html')
"""
return LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Course Experience: ')