Start waffle namespace deprecation
By explicitly importing the legacy namespace classes, we make it clear that we are using soon-to-be-deprecated classes. We will then be able to start removing the legacy classes, one module at a time.
This commit is contained in:
@@ -4,7 +4,7 @@ waffle switches for the contentstore app.
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace, WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace, LegacyWaffleSwitchNamespace
|
||||
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
|
||||
|
||||
# Namespace
|
||||
@@ -18,14 +18,14 @@ def waffle():
|
||||
"""
|
||||
Returns the namespaced, cached, audited Waffle Switch class for Studio pages.
|
||||
"""
|
||||
return WaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Studio: ')
|
||||
return LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Studio: ')
|
||||
|
||||
|
||||
def waffle_flags():
|
||||
"""
|
||||
Returns the namespaced, cached, audited Waffle Flag class for Studio pages.
|
||||
"""
|
||||
return WaffleFlagNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Studio: ')
|
||||
return LegacyWaffleFlagNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Studio: ')
|
||||
|
||||
|
||||
# TODO: After removing this flag, add a migration to remove waffle flag in a follow-up deployment.
|
||||
@@ -51,7 +51,7 @@ SHOW_REVIEW_RULES_FLAG = CourseWaffleFlag(
|
||||
# .. toggle_target_removal_date: 2020-12-31
|
||||
# .. toggle_warnings: Also set settings.LIBRARY_AUTHORING_MICROFRONTEND_URL and ENABLE_LIBRARY_AUTHORING_MICROFRONTEND.
|
||||
# .. toggle_tickets: https://openedx.atlassian.net/wiki/spaces/COMM/pages/1545011241/BD-14+Blockstore+Powered+Content+Libraries+Taxonomies
|
||||
REDIRECT_TO_LIBRARY_AUTHORING_MICROFRONTEND = WaffleFlag(
|
||||
REDIRECT_TO_LIBRARY_AUTHORING_MICROFRONTEND = LegacyWaffleFlag(
|
||||
waffle_namespace=waffle_flags(),
|
||||
flag_name='library_authoring_mfe',
|
||||
module_name=__name__,
|
||||
|
||||
@@ -23,7 +23,7 @@ from django.urls import reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.decorators.http import require_GET, require_http_methods
|
||||
from edx_toggles.toggles import WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleSwitchNamespace
|
||||
from milestones import api as milestones_api
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
@@ -511,7 +511,7 @@ def course_listing(request):
|
||||
"""
|
||||
|
||||
optimization_enabled = GlobalStaff().has_user(request.user) and \
|
||||
WaffleSwitchNamespace(name=WAFFLE_NAMESPACE).is_enabled(u'enable_global_staff_optimization')
|
||||
LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE).is_enabled(u'enable_global_staff_optimization')
|
||||
|
||||
org = request.GET.get('org', '') if optimization_enabled else None
|
||||
courses_iter, in_process_course_actions = get_courses_accessible_to_user(request, org)
|
||||
|
||||
@@ -21,7 +21,7 @@ from edx_proctoring.api import (
|
||||
get_exam_configuration_dashboard_url
|
||||
)
|
||||
from edx_proctoring.exceptions import ProctoredExamNotFoundException
|
||||
from edx_toggles.toggles import WaffleSwitch
|
||||
from edx_toggles.toggles import LegacyWaffleSwitch
|
||||
from help_tokens.core import HelpUrlExpert
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locator import LibraryUsageLocator
|
||||
@@ -91,7 +91,7 @@ NEVER = lambda x: False
|
||||
ALWAYS = lambda x: True
|
||||
|
||||
|
||||
highlights_setting = WaffleSwitch('dynamic_pacing', 'studio_course_update', __name__)
|
||||
highlights_setting = LegacyWaffleSwitch('dynamic_pacing', 'studio_course_update', __name__)
|
||||
|
||||
|
||||
def _filter_entrance_exam_grader(graders):
|
||||
|
||||
@@ -16,7 +16,7 @@ import pytz
|
||||
import six
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
from edx_toggles.toggles import WaffleSwitch
|
||||
from edx_toggles.toggles import LegacyWaffleSwitch
|
||||
from edx_toggles.toggles.testutils import override_waffle_flag, override_waffle_switch
|
||||
from edxval.api import (
|
||||
create_or_update_transcript_preferences,
|
||||
@@ -54,7 +54,7 @@ from ..videos import (
|
||||
convert_video_status
|
||||
)
|
||||
|
||||
VIDEO_IMAGE_UPLOAD_ENABLED_SWITCH = WaffleSwitch(WAFFLE_SWITCHES, VIDEO_IMAGE_UPLOAD_ENABLED)
|
||||
VIDEO_IMAGE_UPLOAD_ENABLED_SWITCH = LegacyWaffleSwitch(WAFFLE_SWITCHES, VIDEO_IMAGE_UPLOAD_ENABLED)
|
||||
|
||||
|
||||
class VideoUploadTestBase(object):
|
||||
|
||||
@@ -44,7 +44,7 @@ from rest_framework import status as rest_status
|
||||
from rest_framework.decorators import api_view
|
||||
from rest_framework.response import Response
|
||||
|
||||
from edx_toggles.toggles import WaffleFlagNamespace, WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlagNamespace, LegacyWaffleSwitchNamespace
|
||||
from common.djangoapps.edxmako.shortcuts import render_to_response
|
||||
from openedx.core.djangoapps.video_config.models import VideoTranscriptEnabledFlag
|
||||
from openedx.core.djangoapps.video_pipeline.config.waffle import (
|
||||
@@ -74,13 +74,13 @@ LOGGER = logging.getLogger(__name__)
|
||||
|
||||
# Waffle switches namespace for videos
|
||||
WAFFLE_NAMESPACE = 'videos'
|
||||
WAFFLE_SWITCHES = WaffleSwitchNamespace(name=WAFFLE_NAMESPACE)
|
||||
WAFFLE_SWITCHES = LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE)
|
||||
|
||||
# Waffle switch for enabling/disabling video image upload feature
|
||||
VIDEO_IMAGE_UPLOAD_ENABLED = 'video_image_upload_enabled'
|
||||
|
||||
# Waffle flag namespace for studio
|
||||
WAFFLE_STUDIO_FLAG_NAMESPACE = WaffleFlagNamespace(name=u'studio')
|
||||
WAFFLE_STUDIO_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name=u'studio')
|
||||
|
||||
ENABLE_VIDEO_UPLOAD_PAGINATION = CourseWaffleFlag(
|
||||
waffle_namespace=WAFFLE_STUDIO_FLAG_NAMESPACE,
|
||||
|
||||
@@ -3,7 +3,7 @@ Student app helpers and settings
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleSwitchNamespace
|
||||
|
||||
# Namespace for student app waffle switches
|
||||
STUDENT_WAFFLE_NAMESPACE = WaffleSwitchNamespace(name='student')
|
||||
STUDENT_WAFFLE_NAMESPACE = LegacyWaffleSwitchNamespace(name='student')
|
||||
|
||||
@@ -22,7 +22,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from edx_toggles.toggles import WaffleSwitch
|
||||
from edx_toggles.toggles import LegacyWaffleSwitch
|
||||
from openedx.core.lib.courses import clean_course_id
|
||||
from common.djangoapps.student import STUDENT_WAFFLE_NAMESPACE
|
||||
from common.djangoapps.student.models import (
|
||||
@@ -53,7 +53,7 @@ User = get_user_model() # pylint:disable=invalid-name
|
||||
# This switch exists because the CourseEnrollment admin views make DB queries that impact performance.
|
||||
# In a large enough deployment of Open edX, this is enough to cause a site outage.
|
||||
# See https://openedx.atlassian.net/browse/OPS-2943
|
||||
COURSE_ENROLLMENT_ADMIN_SWITCH = WaffleSwitch(STUDENT_WAFFLE_NAMESPACE, 'courseenrollment_admin', __name__)
|
||||
COURSE_ENROLLMENT_ADMIN_SWITCH = LegacyWaffleSwitch(STUDENT_WAFFLE_NAMESPACE, 'courseenrollment_admin', __name__)
|
||||
|
||||
|
||||
class _Check(object):
|
||||
|
||||
@@ -16,7 +16,7 @@ from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from edx_django_utils import monitoring as monitoring_utils
|
||||
from edx_django_utils.plugins import get_plugins_view_context
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from pytz import UTC
|
||||
from six import iteritems, text_type
|
||||
@@ -62,7 +62,7 @@ from xmodule.modulestore.django import modulestore
|
||||
|
||||
log = logging.getLogger("edx.student")
|
||||
|
||||
experiments_namespace = WaffleFlagNamespace(name=u'student.experiments')
|
||||
experiments_namespace = LegacyWaffleFlagNamespace(name=u'student.experiments')
|
||||
|
||||
|
||||
def get_org_black_and_whitelist_for_site():
|
||||
@@ -638,7 +638,7 @@ def student_dashboard(request):
|
||||
inverted_programs = meter.invert_programs()
|
||||
|
||||
urls, programs_data = {}, {}
|
||||
bundles_on_dashboard_flag = WaffleFlag(experiments_namespace, u'bundles_on_dashboard', __name__)
|
||||
bundles_on_dashboard_flag = LegacyWaffleFlag(experiments_namespace, u'bundles_on_dashboard', __name__)
|
||||
|
||||
# TODO: Delete this code and the relevant HTML code after testing LEARNER-3072 is complete
|
||||
if bundles_on_dashboard_flag.is_enabled() and inverted_programs and list(inverted_programs.items()):
|
||||
|
||||
@@ -23,7 +23,7 @@ from xblock.core import XBlock
|
||||
from xblock.exceptions import NoSuchServiceError
|
||||
from xblock.fields import Boolean, Integer, List, Scope, String
|
||||
|
||||
from edx_toggles.toggles import WaffleFlag
|
||||
from edx_toggles.toggles import LegacyWaffleFlag
|
||||
from openedx.core.lib.graph_traversals import traverse_pre_order
|
||||
|
||||
from .exceptions import NotFoundError
|
||||
@@ -48,7 +48,7 @@ class_priority = ['video', 'problem']
|
||||
# `django.utils.translation.ugettext_noop` because Django cannot be imported in this file
|
||||
_ = lambda text: text
|
||||
|
||||
TIMED_EXAM_GATING_WAFFLE_FLAG = WaffleFlag(
|
||||
TIMED_EXAM_GATING_WAFFLE_FLAG = LegacyWaffleFlag(
|
||||
waffle_namespace="xmodule",
|
||||
flag_name=u'rev_1377_rollout',
|
||||
module_name=__name__,
|
||||
|
||||
@@ -7,7 +7,7 @@ and disabling for instructor-paced courses.
|
||||
import ddt
|
||||
import mock
|
||||
import six
|
||||
from edx_toggles.toggles import WaffleSwitch
|
||||
from edx_toggles.toggles import LegacyWaffleSwitch
|
||||
from edx_toggles.toggles.testutils import override_waffle_switch
|
||||
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory, UserFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
@@ -26,7 +26,7 @@ from lms.djangoapps.grades.tests.utils import mock_passing_grade
|
||||
from lms.djangoapps.verify_student.models import IDVerificationAttempt, SoftwareSecurePhotoVerification
|
||||
from openedx.core.djangoapps.certificates.config import waffle
|
||||
|
||||
AUTO_CERTIFICATE_GENERATION_SWITCH = WaffleSwitch(waffle.waffle(), waffle.AUTO_CERTIFICATE_GENERATION)
|
||||
AUTO_CERTIFICATE_GENERATION_SWITCH = LegacyWaffleSwitch(waffle.waffle(), waffle.AUTO_CERTIFICATE_GENERATION)
|
||||
|
||||
|
||||
class SelfGeneratedCertsSignalTest(ModuleStoreTestCase):
|
||||
|
||||
@@ -18,7 +18,7 @@ from mock import patch
|
||||
from organizations import api as organizations_api
|
||||
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
from edx_toggles.toggles import WaffleSwitch
|
||||
from edx_toggles.toggles import LegacyWaffleSwitch
|
||||
from edx_toggles.toggles.testutils import override_waffle_switch
|
||||
from lms.djangoapps.badges.events.course_complete import get_completion_badge
|
||||
from lms.djangoapps.badges.tests.factories import (
|
||||
@@ -58,7 +58,7 @@ from common.djangoapps.util.date_utils import strftime_localized
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
AUTO_CERTIFICATE_GENERATION_SWITCH = WaffleSwitch(waffle.waffle(), waffle.AUTO_CERTIFICATE_GENERATION)
|
||||
AUTO_CERTIFICATE_GENERATION_SWITCH = LegacyWaffleSwitch(waffle.waffle(), waffle.AUTO_CERTIFICATE_GENERATION)
|
||||
FEATURES_WITH_CERTS_ENABLED = settings.FEATURES.copy()
|
||||
FEATURES_WITH_CERTS_ENABLED['CERTIFICATES_HTML_VIEW'] = True
|
||||
FEATURES_WITH_BADGES_ENABLED = FEATURES_WITH_CERTS_ENABLED.copy()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
""" Course API """
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleSwitch, WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleSwitch, LegacyWaffleSwitchNamespace
|
||||
|
||||
WAFFLE_SWITCH_NAMESPACE = WaffleSwitchNamespace(name='course_list_api_rate_limit')
|
||||
WAFFLE_SWITCH_NAMESPACE = LegacyWaffleSwitchNamespace(name='course_list_api_rate_limit')
|
||||
|
||||
# .. toggle_name: course_list_api_rate_limit.rate_limit_2
|
||||
# .. toggle_implementation: WaffleSwitch
|
||||
@@ -15,7 +15,7 @@ WAFFLE_SWITCH_NAMESPACE = WaffleSwitchNamespace(name='course_list_api_rate_limit
|
||||
# .. toggle_target_removal_date: None
|
||||
# .. toggle_warnings: None
|
||||
# .. toggle_tickets: https://openedx.atlassian.net/browse/LEARNER-5527
|
||||
USE_RATE_LIMIT_2_FOR_COURSE_LIST_API = WaffleSwitch(WAFFLE_SWITCH_NAMESPACE, 'rate_limit_2', __name__)
|
||||
USE_RATE_LIMIT_2_FOR_COURSE_LIST_API = LegacyWaffleSwitch(WAFFLE_SWITCH_NAMESPACE, 'rate_limit_2', __name__)
|
||||
# .. toggle_name: course_list_api_rate_limit.rate_limit_10
|
||||
# .. toggle_implementation: WaffleSwitch
|
||||
# .. toggle_default: False
|
||||
@@ -26,4 +26,4 @@ USE_RATE_LIMIT_2_FOR_COURSE_LIST_API = WaffleSwitch(WAFFLE_SWITCH_NAMESPACE, 'ra
|
||||
# .. toggle_target_removal_date: None
|
||||
# .. toggle_warnings: None
|
||||
# .. toggle_tickets: https://openedx.atlassian.net/browse/LEARNER-5527
|
||||
USE_RATE_LIMIT_10_FOR_COURSE_LIST_API = WaffleSwitch(WAFFLE_SWITCH_NAMESPACE, 'rate_limit_10', __name__)
|
||||
USE_RATE_LIMIT_10_FOR_COURSE_LIST_API = LegacyWaffleSwitch(WAFFLE_SWITCH_NAMESPACE, 'rate_limit_10', __name__)
|
||||
|
||||
@@ -3,9 +3,9 @@ Toggles for Course API.
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
|
||||
|
||||
COURSE_BLOCKS_API_NAMESPACE = WaffleFlagNamespace(name=u'course_blocks_api')
|
||||
COURSE_BLOCKS_API_NAMESPACE = LegacyWaffleFlagNamespace(name=u'course_blocks_api')
|
||||
|
||||
# .. toggle_name: course_blocks_api.hide_access_denials
|
||||
# .. toggle_implementation: WaffleFlag
|
||||
@@ -16,7 +16,7 @@ COURSE_BLOCKS_API_NAMESPACE = WaffleFlagNamespace(name=u'course_blocks_api')
|
||||
# .. toggle_target_removal_date: None
|
||||
# .. toggle_warnings: This temporary feature toggle does not have a target removal date.
|
||||
# .. toggle_tickets: None
|
||||
HIDE_ACCESS_DENIALS_FLAG = WaffleFlag(
|
||||
HIDE_ACCESS_DENIALS_FLAG = LegacyWaffleFlag(
|
||||
waffle_namespace=COURSE_BLOCKS_API_NAMESPACE,
|
||||
flag_name=u'hide_access_denials',
|
||||
module_name=__name__,
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
Toggles for course home experience.
|
||||
"""
|
||||
|
||||
from edx_toggles.toggles import WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlagNamespace
|
||||
from lms.djangoapps.experiments.flags import ExperimentWaffleFlag
|
||||
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
|
||||
|
||||
WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='course_home')
|
||||
WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name='course_home')
|
||||
|
||||
COURSE_HOME_MICROFRONTEND = ExperimentWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'course_home_mfe', __name__)
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ from django.urls import reverse
|
||||
from edx_proctoring.api import create_exam, create_exam_attempt, update_attempt_status
|
||||
from edx_proctoring.runtime import set_runtime_service
|
||||
from edx_proctoring.tests.test_services import MockCertificateService, MockCreditService, MockGradesService
|
||||
from edx_toggles.toggles import WaffleSwitch
|
||||
from edx_toggles.toggles import LegacyWaffleSwitch
|
||||
from edx_toggles.toggles.testutils import override_waffle_switch
|
||||
from edx_when.field_data import DateLookupFieldData
|
||||
from freezegun import freeze_time
|
||||
@@ -95,7 +95,7 @@ from xmodule.x_module import STUDENT_VIEW, CombinedSystem, XModule, XModuleDescr
|
||||
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
|
||||
|
||||
# pylint: disable=feature-toggle-needs-doc
|
||||
ENABLE_COMPLETION_TRACKING_SWITCH = WaffleSwitch(
|
||||
ENABLE_COMPLETION_TRACKING_SWITCH = LegacyWaffleSwitch(
|
||||
completion_waffle.waffle(), completion_waffle.ENABLE_COMPLETION_TRACKING, __name__
|
||||
)
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
Toggles for courseware in-course experience.
|
||||
"""
|
||||
|
||||
from edx_toggles.toggles import WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlagNamespace
|
||||
from lms.djangoapps.experiments.flags import ExperimentWaffleFlag
|
||||
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
|
||||
|
||||
# Namespace for courseware waffle flags.
|
||||
WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='courseware')
|
||||
WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name='courseware')
|
||||
|
||||
# .. toggle_name: courseware.courseware_mfe
|
||||
# .. toggle_implementation: ExperimentWaffleFlag
|
||||
|
||||
@@ -21,7 +21,7 @@ from django.views.decorators.cache import cache_control
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.generic import View
|
||||
from edx_django_utils.monitoring import set_custom_attributes_for_course_key
|
||||
from edx_toggles.toggles import WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleSwitchNamespace
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
from six.moves import urllib
|
||||
@@ -441,7 +441,7 @@ class CoursewareIndex(View):
|
||||
'xqa_server': settings.FEATURES.get('XQA_SERVER', "http://your_xqa_server.com"),
|
||||
'bookmarks_api_url': reverse('bookmarks'),
|
||||
'language_preference': self._get_language_preference(),
|
||||
'disable_optimizely': not WaffleSwitchNamespace('RET').is_enabled('enable_optimizely_in_courseware'),
|
||||
'disable_optimizely': not LegacyWaffleSwitchNamespace('RET').is_enabled('enable_optimizely_in_courseware'),
|
||||
'section_title': None,
|
||||
'sequence_title': None,
|
||||
'disable_accordion': not DISABLE_COURSE_OUTLINE_PAGE_FLAG.is_enabled(self.course.id),
|
||||
|
||||
@@ -16,7 +16,7 @@ from six import text_type
|
||||
|
||||
from common.djangoapps import third_party_auth
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
from edx_toggles.toggles import WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleSwitchNamespace
|
||||
from lms.djangoapps.email_marketing.tasks import (
|
||||
get_email_cookies_via_sailthru,
|
||||
update_course_enrollment,
|
||||
@@ -40,7 +40,7 @@ CHANGED_FIELDNAMES = ['username', 'is_active', 'name', 'gender', 'education',
|
||||
'country', LANGUAGE_KEY]
|
||||
|
||||
WAFFLE_NAMESPACE = 'sailthru'
|
||||
WAFFLE_SWITCHES = WaffleSwitchNamespace(name=WAFFLE_NAMESPACE)
|
||||
WAFFLE_SWITCHES = LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE)
|
||||
|
||||
SAILTHRU_AUDIT_PURCHASE_ENABLED = 'audit_purchase_enabled'
|
||||
|
||||
|
||||
@@ -625,7 +625,7 @@ class SailthruTests(TestCase):
|
||||
@patch('sailthru.sailthru_client.SailthruClient.purchase')
|
||||
@patch('sailthru.sailthru_client.SailthruClient.api_get')
|
||||
@patch('sailthru.sailthru_client.SailthruClient.api_post')
|
||||
@patch('edx_toggles.toggles.WaffleSwitchNamespace.is_enabled')
|
||||
@patch('edx_toggles.toggles.LegacyWaffleSwitchNamespace.is_enabled')
|
||||
def test_update_course_enrollment_whitelabel(
|
||||
self,
|
||||
switch,
|
||||
@@ -650,7 +650,7 @@ class SailthruTests(TestCase):
|
||||
update_sailthru(None, self.user, 'verified', self.course_id)
|
||||
self.assertFalse(mock_sailthru_purchase.called)
|
||||
|
||||
@patch('edx_toggles.toggles.WaffleSwitchNamespace.is_enabled')
|
||||
@patch('edx_toggles.toggles.LegacyWaffleSwitchNamespace.is_enabled')
|
||||
@patch('sailthru.sailthru_client.SailthruClient.purchase')
|
||||
def test_purchase_is_not_invoked(self, mock_sailthru_purchase, switch):
|
||||
"""Make sure purchase is not called in the following condition:
|
||||
@@ -660,7 +660,7 @@ class SailthruTests(TestCase):
|
||||
update_sailthru(None, self.user, 'verified', self.course_id)
|
||||
self.assertFalse(mock_sailthru_purchase.called)
|
||||
|
||||
@patch('edx_toggles.toggles.WaffleSwitchNamespace.is_enabled')
|
||||
@patch('edx_toggles.toggles.LegacyWaffleSwitchNamespace.is_enabled')
|
||||
@patch('sailthru.sailthru_client.SailthruClient.purchase')
|
||||
def test_encoding_is_working_for_email_contains_unicode(self, mock_sailthru_purchase, switch):
|
||||
"""Make sure encoding is working for emails contains unicode characters
|
||||
|
||||
@@ -12,7 +12,7 @@ from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from common.djangoapps.course_modes.models import format_course_price, get_cosmetic_verified_display_price, CourseMode
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
|
||||
from common.djangoapps.entitlements.models import CourseEntitlement
|
||||
from lms.djangoapps.commerce.utils import EcommerceService
|
||||
from lms.djangoapps.courseware.access import has_staff_access_to_preview_mode
|
||||
@@ -31,7 +31,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# TODO: clean up as part of REVEM-199 (START)
|
||||
experiments_namespace = WaffleFlagNamespace(name=u'experiments')
|
||||
experiments_namespace = LegacyWaffleFlagNamespace(name=u'experiments')
|
||||
|
||||
# .. toggle_name: experiments.add_programs
|
||||
# .. toggle_implementation: WaffleFlag
|
||||
@@ -42,7 +42,7 @@ experiments_namespace = WaffleFlagNamespace(name=u'experiments')
|
||||
# .. toggle_target_removal_date: None
|
||||
# .. toggle_tickets: REVEM-63, REVEM-198
|
||||
# .. toggle_warnings: This temporary feature toggle does not have a target removal date.
|
||||
PROGRAM_INFO_FLAG = WaffleFlag(
|
||||
PROGRAM_INFO_FLAG = LegacyWaffleFlag(
|
||||
waffle_namespace=experiments_namespace,
|
||||
flag_name=u'add_programs',
|
||||
module_name=__name__,
|
||||
@@ -57,7 +57,7 @@ PROGRAM_INFO_FLAG = WaffleFlag(
|
||||
# .. toggle_target_removal_date: None
|
||||
# .. toggle_tickets: REVEM-118
|
||||
# .. toggle_warnings: This temporary feature toggle does not have a target removal date.
|
||||
DASHBOARD_INFO_FLAG = WaffleFlag(experiments_namespace, u'add_dashboard_info', __name__)
|
||||
DASHBOARD_INFO_FLAG = LegacyWaffleFlag(experiments_namespace, u'add_dashboard_info', __name__)
|
||||
# TODO END: clean up as part of REVEM-199 (End)
|
||||
|
||||
# TODO: Clean up as part of REV-1205 (START)
|
||||
@@ -70,7 +70,7 @@ DASHBOARD_INFO_FLAG = WaffleFlag(experiments_namespace, u'add_dashboard_info', _
|
||||
# .. toggle_target_removal_date: None
|
||||
# .. toggle_tickets: REV-1205
|
||||
# .. toggle_warnings: This temporary feature toggle does not have a target removal date.
|
||||
UPSELL_TRACKING_FLAG = WaffleFlag(
|
||||
UPSELL_TRACKING_FLAG = LegacyWaffleFlag(
|
||||
waffle_namespace=experiments_namespace,
|
||||
flag_name=u'add_upsell_tracking',
|
||||
module_name=__name__,
|
||||
|
||||
@@ -16,7 +16,7 @@ from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from common.djangoapps.course_modes.models import get_cosmetic_verified_display_price
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
|
||||
from lms.djangoapps.commerce.utils import EcommerceService
|
||||
from lms.djangoapps.courseware.utils import can_show_verified_upgrade
|
||||
from lms.djangoapps.experiments.stable_bucketing import stable_bucketing_hash_group
|
||||
@@ -37,8 +37,8 @@ from common.djangoapps.track import segment
|
||||
# .. toggle_target_removal_date: None
|
||||
# .. toggle_tickets: REV-934
|
||||
# .. toggle_warnings: This temporary feature toggle does not have a target removal date.
|
||||
MOBILE_UPSELL_FLAG = WaffleFlag(
|
||||
waffle_namespace=WaffleFlagNamespace(name=u'experiments'),
|
||||
MOBILE_UPSELL_FLAG = LegacyWaffleFlag(
|
||||
waffle_namespace=LegacyWaffleFlagNamespace(name=u'experiments'),
|
||||
flag_name=u'mobile_upsell_rev934',
|
||||
module_name=__name__,
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ waffle switches for the Grades app.
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleFlagNamespace, WaffleSwitch, WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlagNamespace, LegacyWaffleSwitch, LegacyWaffleSwitchNamespace
|
||||
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
|
||||
|
||||
# Namespace
|
||||
@@ -89,7 +89,7 @@ def waffle():
|
||||
"""
|
||||
Returns the namespaced, cached, audited Waffle class for Grades.
|
||||
"""
|
||||
return WaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Grades: ')
|
||||
return LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Grades: ')
|
||||
|
||||
|
||||
def waffle_switch(name):
|
||||
@@ -97,9 +97,9 @@ def waffle_switch(name):
|
||||
Return the corresponding namespaced waffle switch.
|
||||
|
||||
WARNING: do not replicate this pattern. Instead of declaring waffle switch names as strings, you should create
|
||||
WaffleSwitch objects as top-level constants.
|
||||
LegacyWaffleSwitch objects as top-level constants.
|
||||
"""
|
||||
return WaffleSwitch(waffle(), name, module_name=__name__)
|
||||
return LegacyWaffleSwitch(waffle(), name, module_name=__name__)
|
||||
|
||||
|
||||
def waffle_flags():
|
||||
@@ -107,9 +107,9 @@ def waffle_flags():
|
||||
Returns the namespaced, cached, audited Waffle flags dictionary for Grades.
|
||||
|
||||
WARNING: do not replicate this pattern. Instead of declaring waffle flag names as strings, you should create
|
||||
WaffleFlag and CourseWaffleFlag objects as top-level constants.
|
||||
LegacyWaffleFlag and CourseWaffleFlag objects as top-level constants.
|
||||
"""
|
||||
namespace = WaffleFlagNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Grades: ')
|
||||
namespace = LegacyWaffleFlagNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Grades: ')
|
||||
return {
|
||||
# By default, enable rejected exam grade overrides. Can be disabled on a course-by-course basis.
|
||||
# TODO: After removing this flag, add a migration to remove waffle flag in a follow-up deployment.
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
Waffle flags for instructor dashboard.
|
||||
"""
|
||||
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
|
||||
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
|
||||
|
||||
WAFFLE_NAMESPACE = 'instructor'
|
||||
# Namespace for instructor waffle flags.
|
||||
WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name=WAFFLE_NAMESPACE)
|
||||
WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name=WAFFLE_NAMESPACE)
|
||||
|
||||
# Waffle flag enable new data download UI on specific course.
|
||||
# .. toggle_name: instructor.enable_data_download_v2
|
||||
@@ -20,7 +20,7 @@ WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name=WAFFLE_NAMESPACE)
|
||||
# .. toggle_warnings: ??
|
||||
# .. toggle_tickets: PROD-1309
|
||||
DATA_DOWNLOAD_V2 = CourseWaffleFlag(
|
||||
waffle_namespace=WaffleFlagNamespace(name=WAFFLE_NAMESPACE, log_prefix='instructor_dashboard: '),
|
||||
waffle_namespace=LegacyWaffleFlagNamespace(name=WAFFLE_NAMESPACE, log_prefix='instructor_dashboard: '),
|
||||
flag_name='enable_data_download_v2',
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@ DATA_DOWNLOAD_V2 = CourseWaffleFlag(
|
||||
# .. toggle_warnings: n/a
|
||||
# .. toggle_tickets: PROD-1740
|
||||
# .. toggle_status: supported
|
||||
OPTIMISED_IS_SMALL_COURSE = WaffleFlag(
|
||||
OPTIMISED_IS_SMALL_COURSE = LegacyWaffleFlag(
|
||||
waffle_namespace=WAFFLE_FLAG_NAMESPACE,
|
||||
flag_name='optimised_is_small_course',
|
||||
)
|
||||
|
||||
@@ -3,12 +3,12 @@ This module contains various configuration settings via
|
||||
waffle switches for the instructor_task app.
|
||||
"""
|
||||
|
||||
from edx_toggles.toggles import WaffleFlagNamespace, WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlagNamespace, LegacyWaffleSwitchNamespace
|
||||
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
|
||||
|
||||
WAFFLE_NAMESPACE = 'instructor_task'
|
||||
INSTRUCTOR_TASK_WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name=WAFFLE_NAMESPACE)
|
||||
WAFFLE_SWITCHES = WaffleSwitchNamespace(name=WAFFLE_NAMESPACE)
|
||||
INSTRUCTOR_TASK_WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name=WAFFLE_NAMESPACE)
|
||||
WAFFLE_SWITCHES = LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE)
|
||||
|
||||
# Waffle switches
|
||||
OPTIMIZE_GET_LEARNERS_FOR_COURSE = 'optimize_get_learners_for_course'
|
||||
|
||||
@@ -34,7 +34,7 @@ def are_team_submissions_enabled(course_key):
|
||||
):
|
||||
return True
|
||||
|
||||
# TODO: this behaviour differs from edx-ora2, where the WaffleSwitch overrides the setting.
|
||||
# TODO: this behaviour differs from edx-ora2, where the LegacyWaffleSwitch overrides the setting.
|
||||
# https://github.com/edx/edx-ora2/blob/ac502d8301cb987c9885aaefbaeddaf456c13fb9/openassessment/xblock/config_mixin.py#L96
|
||||
|
||||
if TEAM_SUBMISSIONS_FEATURE.is_enabled():
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
Toggles for verify_student app
|
||||
"""
|
||||
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
|
||||
|
||||
# Namespace for verify_students waffle flags.
|
||||
WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='verify_student')
|
||||
WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name='verify_student')
|
||||
|
||||
# Waffle flag to use new email templates for sending ID verification emails.
|
||||
# .. toggle_name: verify_student.use_new_email_templates
|
||||
@@ -18,7 +18,7 @@ WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='verify_student')
|
||||
# .. toggle_target_removal_date: None
|
||||
# .. toggle_warnings: This temporary feature toggle does not have a target removal date.
|
||||
# .. toggle_tickets: PROD-1639
|
||||
USE_NEW_EMAIL_TEMPLATES = WaffleFlag(
|
||||
USE_NEW_EMAIL_TEMPLATES = LegacyWaffleFlag(
|
||||
waffle_namespace=WAFFLE_FLAG_NAMESPACE,
|
||||
flag_name='use_new_email_templates',
|
||||
module_name=__name__,
|
||||
|
||||
@@ -4,7 +4,7 @@ waffle switches for the Certificates app.
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleSwitchNamespace
|
||||
|
||||
# Namespace
|
||||
WAFFLE_NAMESPACE = u'certificates'
|
||||
@@ -17,4 +17,4 @@ def waffle():
|
||||
"""
|
||||
Returns the namespaced, cached, audited Waffle class for Certificates.
|
||||
"""
|
||||
return WaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Certificates: ')
|
||||
return LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Certificates: ')
|
||||
|
||||
@@ -8,7 +8,7 @@ import ddt
|
||||
import pytz
|
||||
import waffle
|
||||
from django.test import TestCase
|
||||
from edx_toggles.toggles import WaffleSwitch
|
||||
from edx_toggles.toggles import LegacyWaffleSwitch
|
||||
from edx_toggles.toggles.testutils import override_waffle_switch
|
||||
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
@@ -68,7 +68,7 @@ class MockGeneratedCertificate(object):
|
||||
@contextmanager
|
||||
def configure_waffle_namespace(feature_enabled):
|
||||
namespace = certs_waffle.waffle()
|
||||
auto_certificate_generation_switch = WaffleSwitch(namespace, certs_waffle.AUTO_CERTIFICATE_GENERATION)
|
||||
auto_certificate_generation_switch = LegacyWaffleSwitch(namespace, certs_waffle.AUTO_CERTIFICATE_GENERATION)
|
||||
with override_waffle_switch(auto_certificate_generation_switch, active=feature_enabled):
|
||||
yield
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ waffle switches for the Block Structure framework.
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleSwitch, WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleSwitch, LegacyWaffleSwitchNamespace
|
||||
from openedx.core.lib.cache_utils import request_cached
|
||||
|
||||
from .models import BlockStructureConfiguration
|
||||
@@ -22,7 +22,7 @@ def waffle():
|
||||
"""
|
||||
Returns the namespaced and cached Waffle class for BlockStructures.
|
||||
"""
|
||||
return WaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'BlockStructure: ')
|
||||
return LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'BlockStructure: ')
|
||||
|
||||
|
||||
def waffle_switch(name):
|
||||
@@ -30,9 +30,9 @@ def waffle_switch(name):
|
||||
Return the waffle switch associated to this namespace.
|
||||
|
||||
WARNING: do not replicate this pattern. Instead of declaring waffle switch names as strings, you should create
|
||||
WaffleSwitch objects as top-level constants.
|
||||
LegacyWaffleSwitch objects as top-level constants.
|
||||
"""
|
||||
return WaffleSwitch(waffle(), name, module_name=__name__)
|
||||
return LegacyWaffleSwitch(waffle(), name, module_name=__name__)
|
||||
|
||||
|
||||
@request_cached()
|
||||
|
||||
@@ -4,12 +4,12 @@ waffle switches for the course_details view.
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleFlagNamespace, WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlagNamespace, LegacyWaffleSwitchNamespace
|
||||
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
|
||||
|
||||
COURSE_DETAIL_WAFFLE_NAMESPACE = 'course_detail'
|
||||
COURSE_DETAIL_WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name=COURSE_DETAIL_WAFFLE_NAMESPACE)
|
||||
WAFFLE_SWITCHES = WaffleSwitchNamespace(name=COURSE_DETAIL_WAFFLE_NAMESPACE)
|
||||
COURSE_DETAIL_WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name=COURSE_DETAIL_WAFFLE_NAMESPACE)
|
||||
WAFFLE_SWITCHES = LegacyWaffleSwitchNamespace(name=COURSE_DETAIL_WAFFLE_NAMESPACE)
|
||||
|
||||
# Course Override Flag
|
||||
COURSE_DETAIL_UPDATE_CERTIFICATE_DATE = u'course_detail_update_certificate_date'
|
||||
|
||||
@@ -10,12 +10,12 @@ this package should be kept small, thin, and stateless.
|
||||
"""
|
||||
default_app_config = 'openedx.core.djangoapps.programs.apps.ProgramsConfig'
|
||||
|
||||
from edx_toggles.toggles import WaffleSwitch, WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleSwitch, LegacyWaffleSwitchNamespace
|
||||
|
||||
PROGRAMS_WAFFLE_SWITCH_NAMESPACE = WaffleSwitchNamespace(name='programs')
|
||||
PROGRAMS_WAFFLE_SWITCH_NAMESPACE = LegacyWaffleSwitchNamespace(name='programs')
|
||||
|
||||
# This is meant to be enabled until https://openedx.atlassian.net/browse/LEARNER-5573 needs to be resolved
|
||||
ALWAYS_CALCULATE_PROGRAM_PRICE_AS_ANONYMOUS_USER = WaffleSwitch(
|
||||
ALWAYS_CALCULATE_PROGRAM_PRICE_AS_ANONYMOUS_USER = LegacyWaffleSwitch(
|
||||
PROGRAMS_WAFFLE_SWITCH_NAMESPACE,
|
||||
'always_calculate_program_price_as_anonymous_user',
|
||||
__name__
|
||||
|
||||
@@ -3,11 +3,11 @@ Contains configuration for schedules app
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace, WaffleSwitch, WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace, LegacyWaffleSwitch, LegacyWaffleSwitchNamespace
|
||||
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
|
||||
|
||||
WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='schedules')
|
||||
WAFFLE_SWITCH_NAMESPACE = WaffleSwitchNamespace(name='schedules')
|
||||
WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name='schedules')
|
||||
WAFFLE_SWITCH_NAMESPACE = LegacyWaffleSwitchNamespace(name='schedules')
|
||||
|
||||
CREATE_SCHEDULE_WAFFLE_FLAG = CourseWaffleFlag(
|
||||
waffle_namespace=WAFFLE_FLAG_NAMESPACE,
|
||||
@@ -21,9 +21,9 @@ COURSE_UPDATE_WAFFLE_FLAG = CourseWaffleFlag(
|
||||
module_name=__name__,
|
||||
)
|
||||
|
||||
DEBUG_MESSAGE_WAFFLE_FLAG = WaffleFlag(WAFFLE_FLAG_NAMESPACE, 'enable_debugging', __name__)
|
||||
DEBUG_MESSAGE_WAFFLE_FLAG = LegacyWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'enable_debugging', __name__)
|
||||
|
||||
COURSE_UPDATE_SHOW_UNSUBSCRIBE_WAFFLE_SWITCH = WaffleSwitch(
|
||||
COURSE_UPDATE_SHOW_UNSUBSCRIBE_WAFFLE_SWITCH = LegacyWaffleSwitch(
|
||||
WAFFLE_SWITCH_NAMESPACE,
|
||||
'course_update_show_unsubscribe',
|
||||
__name__
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Toggles for accounts related code.
|
||||
"""
|
||||
|
||||
from edx_toggles.toggles import WaffleFlag
|
||||
from edx_toggles.toggles import LegacyWaffleFlag
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
|
||||
# .. toggle_name: order_history.redirect_to_microfrontend
|
||||
@@ -15,7 +15,7 @@ from openedx.core.djangoapps.site_configuration import helpers as configuration_
|
||||
# .. toggle_warnings: Also set settings.ORDER_HISTORY_MICROFRONTEND_URL and site's
|
||||
# ENABLE_ORDER_HISTORY_MICROFRONTEND.
|
||||
# .. toggle_tickets: DEPR-17
|
||||
REDIRECT_TO_ORDER_HISTORY_MICROFRONTEND = WaffleFlag('order_history', 'redirect_to_microfrontend', __name__)
|
||||
REDIRECT_TO_ORDER_HISTORY_MICROFRONTEND = LegacyWaffleFlag('order_history', 'redirect_to_microfrontend', __name__)
|
||||
|
||||
|
||||
def should_redirect_to_order_history_microfrontend():
|
||||
@@ -34,7 +34,7 @@ def should_redirect_to_order_history_microfrontend():
|
||||
# .. toggle_target_removal_date: 2020-12-31
|
||||
# .. toggle_warnings: Also set settings.ACCOUNT_MICROFRONTEND_URL and site's ENABLE_ACCOUNT_MICROFRONTEND.
|
||||
# .. toggle_tickets: DEPR-17
|
||||
REDIRECT_TO_ACCOUNT_MICROFRONTEND = WaffleFlag('account', 'redirect_to_microfrontend', __name__)
|
||||
REDIRECT_TO_ACCOUNT_MICROFRONTEND = LegacyWaffleFlag('account', 'redirect_to_microfrontend', __name__)
|
||||
|
||||
|
||||
def should_redirect_to_account_microfrontend():
|
||||
|
||||
@@ -5,7 +5,7 @@ Waffle flags and switches to change user API functionality.
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from edx_toggles.toggles import WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleSwitchNamespace
|
||||
|
||||
SYSTEM_MAINTENANCE_MSG = _(u'System maintenance in progress. Please try again later.')
|
||||
WAFFLE_NAMESPACE = u'user_api'
|
||||
@@ -18,4 +18,4 @@ def waffle():
|
||||
"""
|
||||
Returns the namespaced, cached, audited Waffle class for user_api.
|
||||
"""
|
||||
return WaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'UserAPI: ')
|
||||
return LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'UserAPI: ')
|
||||
|
||||
@@ -3,10 +3,10 @@ Waffle flags and switches for user authn.
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleSwitch, WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleSwitch, LegacyWaffleSwitchNamespace
|
||||
|
||||
_WAFFLE_NAMESPACE = u'user_authn'
|
||||
_WAFFLE_SWITCH_NAMESPACE = WaffleSwitchNamespace(name=_WAFFLE_NAMESPACE, log_prefix=u'UserAuthN: ')
|
||||
_WAFFLE_SWITCH_NAMESPACE = LegacyWaffleSwitchNamespace(name=_WAFFLE_NAMESPACE, log_prefix=u'UserAuthN: ')
|
||||
|
||||
# .. toggle_name: user_authn.enable_login_using_thirdparty_auth_only
|
||||
# .. toggle_implementation: WaffleSwitch
|
||||
@@ -18,7 +18,7 @@ _WAFFLE_SWITCH_NAMESPACE = WaffleSwitchNamespace(name=_WAFFLE_NAMESPACE, log_pre
|
||||
# .. toggle_target_removal_date: 2020-01-31
|
||||
# .. toggle_warnings: Requires THIRD_PARTY_AUTH_ONLY_DOMAIN to also be set.
|
||||
# .. toggle_tickets: ENT-2461
|
||||
ENABLE_LOGIN_USING_THIRDPARTY_AUTH_ONLY = WaffleSwitch(
|
||||
ENABLE_LOGIN_USING_THIRDPARTY_AUTH_ONLY = LegacyWaffleSwitch(
|
||||
_WAFFLE_SWITCH_NAMESPACE,
|
||||
'enable_login_using_thirdparty_auth_only',
|
||||
__name__
|
||||
|
||||
@@ -21,7 +21,7 @@ from django.utils.translation import get_language
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.csrf import csrf_exempt, ensure_csrf_cookie
|
||||
from django.views.decorators.debug import sensitive_post_parameters
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
|
||||
from pytz import UTC
|
||||
from ratelimit.decorators import ratelimit
|
||||
from requests import HTTPError
|
||||
@@ -104,8 +104,8 @@ REGISTER_USER = Signal(providing_args=["user", "registration"])
|
||||
# .. 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 = WaffleFlag(
|
||||
waffle_namespace=WaffleFlagNamespace(name=u'registration'),
|
||||
REGISTRATION_FAILURE_LOGGING_FLAG = LegacyWaffleFlag(
|
||||
waffle_namespace=LegacyWaffleFlagNamespace(name=u'registration'),
|
||||
flag_name=u'enable_failure_logging',
|
||||
module_name=__name__,
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ Waffle flags and switches
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleSwitchNamespace
|
||||
|
||||
WAFFLE_NAMESPACE = u'open_edx_util'
|
||||
|
||||
@@ -15,4 +15,4 @@ def waffle():
|
||||
"""
|
||||
Returns the namespaced, cached, audited Waffle class for open_edx_util.
|
||||
"""
|
||||
return WaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'OpenEdX Util: ')
|
||||
return LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'OpenEdX Util: ')
|
||||
|
||||
@@ -3,7 +3,7 @@ This module contains configuration settings via waffle flags
|
||||
for the Video Pipeline app.
|
||||
"""
|
||||
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
|
||||
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
|
||||
|
||||
# Videos Namespace
|
||||
@@ -40,14 +40,14 @@ def waffle_flags():
|
||||
"""
|
||||
Returns the namespaced, cached, audited Waffle flags dictionary for Videos.
|
||||
"""
|
||||
namespace = WaffleFlagNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Videos: ')
|
||||
namespace = LegacyWaffleFlagNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Videos: ')
|
||||
return {
|
||||
DEPRECATE_YOUTUBE: CourseWaffleFlag(
|
||||
waffle_namespace=namespace,
|
||||
flag_name=DEPRECATE_YOUTUBE,
|
||||
module_name=__name__,
|
||||
),
|
||||
ENABLE_DEVSTACK_VIDEO_UPLOADS: WaffleFlag(
|
||||
ENABLE_DEVSTACK_VIDEO_UPLOADS: LegacyWaffleFlag(
|
||||
waffle_namespace=namespace,
|
||||
flag_name=ENABLE_DEVSTACK_VIDEO_UPLOADS,
|
||||
module_name=__name__,
|
||||
|
||||
@@ -7,16 +7,18 @@ import warnings
|
||||
from contextlib import contextmanager
|
||||
|
||||
from edx_django_utils.monitoring import set_custom_attribute
|
||||
from edx_toggles.toggles import WaffleFlag as BaseWaffleFlag
|
||||
from edx_toggles.toggles import WaffleFlagNamespace as BaseWaffleFlagNamespace
|
||||
from edx_toggles.toggles import WaffleSwitch as BaseWaffleSwitch
|
||||
from edx_toggles.toggles import WaffleSwitchNamespace as BaseWaffleSwitchNamespace
|
||||
from edx_toggles.toggles import (
|
||||
LegacyWaffleFlag,
|
||||
LegacyWaffleFlagNamespace,
|
||||
LegacyWaffleSwitch,
|
||||
LegacyWaffleSwitchNamespace,
|
||||
)
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class WaffleSwitchNamespace(BaseWaffleSwitchNamespace):
|
||||
class WaffleSwitchNamespace(LegacyWaffleSwitchNamespace):
|
||||
"""
|
||||
Deprecated class: instead, use edx_toggles.toggles.WaffleSwitchNamespace.
|
||||
"""
|
||||
@@ -31,7 +33,9 @@ class WaffleSwitchNamespace(BaseWaffleSwitchNamespace):
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
set_custom_attribute("deprecated_waffle_utils", "WaffleSwitchNamespace[{}]".format(name))
|
||||
set_custom_attribute(
|
||||
"deprecated_waffle_utils", "WaffleSwitchNamespace[{}]".format(name)
|
||||
)
|
||||
|
||||
@contextmanager
|
||||
def override(self, switch_name, active=True):
|
||||
@@ -52,12 +56,12 @@ class WaffleSwitchNamespace(BaseWaffleSwitchNamespace):
|
||||
from edx_toggles.toggles.testutils import override_waffle_switch
|
||||
|
||||
with override_waffle_switch(
|
||||
BaseWaffleSwitch(self, switch_name, module_name=__name__), active
|
||||
LegacyWaffleSwitch(self, switch_name, module_name=__name__), active
|
||||
):
|
||||
yield
|
||||
|
||||
|
||||
class WaffleSwitch(BaseWaffleSwitch):
|
||||
class WaffleSwitch(LegacyWaffleSwitch):
|
||||
"""
|
||||
Deprecated class: instead, use edx_toggles.toggles.WaffleSwitch.
|
||||
"""
|
||||
@@ -69,10 +73,12 @@ class WaffleSwitch(BaseWaffleSwitch):
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
set_custom_attribute("deprecated_waffle_utils", "WaffleSwitch[{}]".format(self.name))
|
||||
set_custom_attribute(
|
||||
"deprecated_waffle_utils", "WaffleSwitch[{}]".format(self.name)
|
||||
)
|
||||
|
||||
|
||||
class WaffleFlagNamespace(BaseWaffleFlagNamespace):
|
||||
class WaffleFlagNamespace(LegacyWaffleFlagNamespace):
|
||||
"""
|
||||
Deprecated class: instead, use edx_toggles.toggles.WaffleFlagNamespace.
|
||||
"""
|
||||
@@ -84,10 +90,12 @@ class WaffleFlagNamespace(BaseWaffleFlagNamespace):
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
set_custom_attribute("deprecated_waffle_utils", "WaffleFlagNamespace[{}]".format(name))
|
||||
set_custom_attribute(
|
||||
"deprecated_waffle_utils", "WaffleFlagNamespace[{}]".format(name)
|
||||
)
|
||||
|
||||
|
||||
class WaffleFlag(BaseWaffleFlag):
|
||||
class WaffleFlag(LegacyWaffleFlag):
|
||||
"""
|
||||
Deprecated class: instead, use edx_toggles.toggles.WaffleFlag.
|
||||
"""
|
||||
@@ -99,7 +107,9 @@ class WaffleFlag(BaseWaffleFlag):
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
set_custom_attribute("deprecated_waffle_utils", "WaffleFlag[{}]".format(self.name))
|
||||
set_custom_attribute(
|
||||
"deprecated_waffle_utils", "WaffleFlag[{}]".format(self.name)
|
||||
)
|
||||
|
||||
@contextmanager
|
||||
def override(self, active=True):
|
||||
@@ -155,15 +165,13 @@ class CourseWaffleFlag(BaseWaffleFlag):
|
||||
from .models import WaffleFlagCourseOverrideModel
|
||||
|
||||
cache_key = "{}.{}".format(self.namespaced_flag_name, str(course_key))
|
||||
# pylint: disable=protected-access
|
||||
course_override = self.waffle_namespace._cached_flags.get(cache_key)
|
||||
course_override = self._cached_flags.get(cache_key)
|
||||
|
||||
if course_override is None:
|
||||
course_override = WaffleFlagCourseOverrideModel.override_value(
|
||||
self.namespaced_flag_name, course_key
|
||||
)
|
||||
# pylint: disable=protected-access
|
||||
self.waffle_namespace._cached_flags[cache_key] = course_override
|
||||
self._cached_flags[cache_key] = course_override
|
||||
|
||||
if course_override == WaffleFlagCourseOverrideModel.ALL_CHOICES.on:
|
||||
return True
|
||||
@@ -189,8 +197,6 @@ class CourseWaffleFlag(BaseWaffleFlag):
|
||||
is_enabled_for_course = self._get_course_override_value(course_key)
|
||||
if is_enabled_for_course is not None:
|
||||
# pylint: disable=protected-access
|
||||
self.waffle_namespace._monitor_value(
|
||||
self.flag_name, is_enabled_for_course
|
||||
)
|
||||
self.waffle_namespace._monitor_value(self.flag_name, is_enabled_for_course)
|
||||
return is_enabled_for_course
|
||||
return super().is_enabled()
|
||||
|
||||
@@ -12,14 +12,14 @@ from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from six.moves.urllib.parse import urlparse
|
||||
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
|
||||
# accommodates course api urls, excluding any course api routes that do not fall under v*/courses, such as v1/blocks.
|
||||
COURSE_REGEX = re.compile(r'^(.*?/courses/)(?!v[0-9]+/[^/]+){}'.format(settings.COURSE_ID_PATTERN))
|
||||
|
||||
WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='request_utils')
|
||||
CAPTURE_COOKIE_SIZES = WaffleFlag(WAFFLE_FLAG_NAMESPACE, 'capture_cookie_sizes', __name__)
|
||||
WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name='request_utils')
|
||||
CAPTURE_COOKIE_SIZES = LegacyWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'capture_cookie_sizes', __name__)
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@@ -6,15 +6,15 @@ from django.utils.translation import ugettext as _
|
||||
from edx_django_utils.monitoring import set_custom_attribute
|
||||
from waffle import flag_is_active
|
||||
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
|
||||
from lms.djangoapps.experiments.flags import ExperimentWaffleFlag
|
||||
from openedx.core.djangoapps.util.user_messages import UserMessageCollection
|
||||
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
|
||||
|
||||
# Namespace for course experience waffle flags.
|
||||
WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='course_experience')
|
||||
WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name='course_experience')
|
||||
|
||||
COURSE_EXPERIENCE_WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='course_experience')
|
||||
COURSE_EXPERIENCE_WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name='course_experience')
|
||||
|
||||
# Waffle flag to disable the separate course outline page and full width content.
|
||||
DISABLE_COURSE_OUTLINE_PAGE_FLAG = CourseWaffleFlag(
|
||||
@@ -30,7 +30,7 @@ DISABLE_UNIFIED_COURSE_TAB_FLAG = CourseWaffleFlag(
|
||||
DISPLAY_COURSE_SOCK_FLAG = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'display_course_sock', __name__)
|
||||
|
||||
# Waffle flag to let learners access a course before its start date.
|
||||
COURSE_PRE_START_ACCESS_FLAG = WaffleFlag(WAFFLE_FLAG_NAMESPACE, 'pre_start_access', __name__)
|
||||
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
|
||||
@@ -65,7 +65,7 @@ UPGRADE_DEADLINE_MESSAGE = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'upgrade_dead
|
||||
LATEST_UPDATE_FLAG = CourseWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'latest_update', __name__)
|
||||
|
||||
# Waffle flag to enable anonymous access to a course
|
||||
SEO_WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='seo')
|
||||
SEO_WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name='seo')
|
||||
COURSE_ENABLE_UNENROLLED_ACCESS_FLAG = CourseWaffleFlag(
|
||||
SEO_WAFFLE_FLAG_NAMESPACE,
|
||||
'enable_anonymous_courseware_access',
|
||||
|
||||
@@ -3,7 +3,7 @@ Miscellaneous waffle switches that both LMS and Studio need to access
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleSwitchNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleSwitchNamespace
|
||||
|
||||
# Namespace
|
||||
WAFFLE_NAMESPACE = u'course_experience'
|
||||
@@ -25,4 +25,4 @@ def waffle():
|
||||
"""
|
||||
Returns the namespaced, cached, audited shared Waffle Switch class.
|
||||
"""
|
||||
return WaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Course Experience: ')
|
||||
return LegacyWaffleSwitchNamespace(name=WAFFLE_NAMESPACE, log_prefix=u'Course Experience: ')
|
||||
|
||||
@@ -16,7 +16,7 @@ import pytz
|
||||
from crum import get_current_request, impersonate
|
||||
from django.utils import timezone
|
||||
from django.utils.dateparse import parse_datetime
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
|
||||
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
from common.djangoapps.entitlements.models import CourseEntitlement
|
||||
@@ -35,8 +35,8 @@ from common.djangoapps.track import segment
|
||||
# .. toggle_target_removal_date: None
|
||||
# .. toggle_tickets: REVEM-282
|
||||
# .. toggle_warnings: This temporary feature toggle does not have a target removal date.
|
||||
DISCOUNT_APPLICABILITY_FLAG = WaffleFlag(
|
||||
waffle_namespace=WaffleFlagNamespace(name=u'discounts'),
|
||||
DISCOUNT_APPLICABILITY_FLAG = LegacyWaffleFlag(
|
||||
waffle_namespace=LegacyWaffleFlagNamespace(name=u'discounts'),
|
||||
flag_name=u'enable_discounting',
|
||||
module_name=__name__,
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ from django.conf import settings
|
||||
from django.urls import NoReverseMatch, reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
from edx_django_utils.cache import TieredCache, get_cache_key
|
||||
from edx_toggles.toggles import WaffleFlag
|
||||
from edx_toggles.toggles import LegacyWaffleFlag
|
||||
from enterprise.api.v1.serializers import EnterpriseCustomerBrandingConfigurationSerializer
|
||||
from enterprise.models import EnterpriseCustomer, EnterpriseCustomerUser
|
||||
from social_django.models import UserSocialAuth
|
||||
@@ -22,7 +22,7 @@ from openedx.core.djangoapps.user_authn.cookies import standard_cookie_settings
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
from common.djangoapps.student.helpers import get_next_url_for_login_page
|
||||
|
||||
ENTERPRISE_HEADER_LINKS = WaffleFlag('enterprise', 'enterprise_header_links', __name__)
|
||||
ENTERPRISE_HEADER_LINKS = LegacyWaffleFlag('enterprise', 'enterprise_header_links', __name__)
|
||||
|
||||
|
||||
def get_data_consent_share_cache_key(user_id, course_id):
|
||||
|
||||
@@ -3,11 +3,11 @@ Toggles for Learner Profile page.
|
||||
"""
|
||||
|
||||
|
||||
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace
|
||||
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
|
||||
# Namespace for learner profile waffle flags.
|
||||
WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='learner_profile')
|
||||
WAFFLE_FLAG_NAMESPACE = LegacyWaffleFlagNamespace(name='learner_profile')
|
||||
|
||||
# Waffle flag to redirect to another learner profile experience.
|
||||
# .. toggle_name: learner_profile.redirect_to_microfrontend
|
||||
@@ -19,7 +19,7 @@ WAFFLE_FLAG_NAMESPACE = WaffleFlagNamespace(name='learner_profile')
|
||||
# .. 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(WAFFLE_FLAG_NAMESPACE, 'redirect_to_microfrontend', __name__)
|
||||
REDIRECT_TO_PROFILE_MICROFRONTEND = LegacyWaffleFlag(WAFFLE_FLAG_NAMESPACE, 'redirect_to_microfrontend', __name__)
|
||||
|
||||
|
||||
def should_redirect_to_profile_microfrontend():
|
||||
|
||||
Reference in New Issue
Block a user