Import waffle classes from edx_toggles instead of waffle_utils

Those classes were ported to edx_toggles. The imports remain in
waffle_utils.__init__ for backward compatibility.
This commit is contained in:
Régis Behmo
2020-10-23 14:51:35 +02:00
parent 3b127f8c92
commit 4586002956
64 changed files with 141 additions and 183 deletions

View File

@@ -4,12 +4,8 @@ waffle switches for the contentstore app.
"""
from openedx.core.djangoapps.waffle_utils import (
CourseWaffleFlag,
WaffleFlag,
WaffleFlagNamespace,
WaffleSwitchNamespace
)
from edx_toggles.toggles import WaffleFlag, WaffleFlagNamespace, WaffleSwitchNamespace
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
# Namespace
WAFFLE_NAMESPACE = u'studio'

View File

@@ -9,20 +9,16 @@ import os
import shutil
import tarfile
from datetime import datetime
from math import ceil
from tempfile import NamedTemporaryFile, mkdtemp
from ccx_keys.locator import CCXLocator
from celery import group
from celery.task import task
from celery.utils.log import get_task_logger
from celery_utils.persist_on_failure import LoggedPersistOnFailureTask
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import User
from django.core.exceptions import SuspiciousOperation
from django.core.files import File
from django.core.files.base import ContentFile
from django.test import RequestFactory
from django.utils.text import get_valid_filename
from django.utils.translation import ugettext as _
@@ -32,7 +28,6 @@ from organizations.models import OrganizationCourse
from path import Path as path
from pytz import UTC
from six import iteritems, text_type
from six.moves import range
from user_tasks.models import UserTaskArtifact, UserTaskStatus
from user_tasks.tasks import UserTask
@@ -57,12 +52,6 @@ from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import DuplicateCourseError, ItemNotFoundError
from xmodule.modulestore.xml_exporter import export_course_to_xml, export_library_to_xml
from xmodule.modulestore.xml_importer import import_course_from_xml, import_library_from_xml
from xmodule.video_module.transcripts_utils import (
Transcript,
TranscriptsGenerationException,
clean_video_id,
get_transcript_from_contentstore
)
User = get_user_model()

View File

@@ -15,6 +15,7 @@ from crum import set_current_request
from django.conf import settings
from django.test import RequestFactory
from django.test.utils import override_settings
from edx_toggles.toggles.testutils import override_waffle_flag
from milestones.models import MilestoneRelationshipType
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import Mock, patch
@@ -30,7 +31,6 @@ from cms.djangoapps.models.settings.course_metadata import CourseMetadata
from cms.djangoapps.models.settings.encoder import CourseSettingsEncoder
from cms.djangoapps.models.settings.waffle import MATERIAL_RECOMPUTE_ONLY_FLAG
from course_modes.models import CourseMode
from edx_toggles.toggles.testutils import override_waffle_flag
from openedx.core.djangoapps.models.course_details import CourseDetails
from student.roles import CourseInstructorRole, CourseStaffRole
from student.tests.factories import UserFactory

View File

@@ -23,6 +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 milestones import api as milestones_api
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
@@ -43,7 +44,6 @@ from openedx.core.djangoapps.credit.api import get_credit_requirements, is_credi
from openedx.core.djangoapps.credit.tasks import update_credit_course_requirements
from openedx.core.djangoapps.models.course_details import CourseDetails
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace
from openedx.core.djangolib.js_utils import dump_js_escaped_json
from openedx.core.lib.course_tabs import CourseTabPluginManager
from openedx.core.lib.courses import course_image_url

View File

@@ -2,7 +2,6 @@
Helper methods for Studio views.
"""
import hashlib
from uuid import uuid4
import six
@@ -17,7 +16,6 @@ from edxmako.shortcuts import render_to_string
from openedx.core.toggles import ENTRANCE_EXAMS
from xmodule.modulestore.django import modulestore
from xmodule.tabs import StaticTab
from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT
from ..utils import reverse_course_url, reverse_library_url, reverse_usage_url

View File

@@ -21,6 +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 help_tokens.core import HelpUrlExpert
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import LibraryUsageLocator
@@ -36,7 +37,6 @@ from cms.djangoapps.xblock_config.models import CourseEditLTIFieldsEnabledFlag
from cms.lib.xblock.authoring_mixin import VISIBILITY_VIEW
from edxmako.shortcuts import render_to_string
from openedx.core.djangoapps.schedules.config import COURSE_UPDATE_WAFFLE_FLAG
from openedx.core.djangoapps.waffle_utils import WaffleSwitch
from openedx.core.lib.gating import api as gating_api
from openedx.core.lib.xblock_utils import hash_resource, request_token, wrap_xblock, wrap_xblock_aside
from static_replace import replace_static_urls

View File

@@ -23,7 +23,6 @@ from cms.djangoapps.contentstore.tests.utils import CourseTestCase
from cms.djangoapps.contentstore.utils import add_instructor, reverse_course_url, reverse_usage_url
from course_action_state.managers import CourseRerunUIStateManager
from course_action_state.models import CourseRerunState
from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES
from student.auth import has_course_author_access
from student.roles import CourseStaffRole, GlobalStaff, LibraryUserRole

View File

@@ -13,6 +13,7 @@ from django.test import TestCase
from django.test.client import RequestFactory
from django.urls import reverse
from edx_proctoring.exceptions import ProctoredExamNotFoundException
from edx_toggles.toggles.testutils import override_waffle_switch
from mock import Mock, PropertyMock, patch
from opaque_keys import InvalidKeyError
from opaque_keys.edx.asides import AsideUsageKeyV2
@@ -35,7 +36,6 @@ from cms.djangoapps.contentstore.tests.utils import CourseTestCase
from cms.djangoapps.contentstore.utils import reverse_course_url, reverse_usage_url
from cms.djangoapps.contentstore.views import item as item_module
from lms_xblock.mixin import NONSENSICAL_ACCESS_RESTRICTION
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_switch
from student.tests.factories import UserFactory
from xblock_django.models import XBlockConfiguration, XBlockStudioConfiguration, XBlockStudioConfigurationFlag
from xblock_django.user_service import DjangoXBlockUserService

View File

@@ -9,7 +9,6 @@ import json
import re
from contextlib import contextmanager
from datetime import datetime
from functools import wraps
import dateutil.parser
import ddt
@@ -17,6 +16,8 @@ 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.testutils import override_waffle_flag, override_waffle_switch
from edxval.api import (
create_or_update_transcript_preferences,
create_or_update_video_transcript,
@@ -33,17 +34,13 @@ from waffle.testutils import override_flag
from cms.djangoapps.contentstore.models import VideoUploadConfig
from cms.djangoapps.contentstore.tests.utils import CourseTestCase
from cms.djangoapps.contentstore.utils import reverse_course_url
from edx_toggles.toggles.testutils import override_waffle_flag
from openedx.core.djangoapps.profile_images.tests.helpers import make_image_file
from openedx.core.djangoapps.video_pipeline.config.waffle import (
DEPRECATE_YOUTUBE,
ENABLE_DEVSTACK_VIDEO_UPLOADS,
waffle_flags
)
from openedx.core.djangoapps.video_pipeline.models import VEMPipelineIntegration
from openedx.core.djangoapps.waffle_utils import WaffleSwitch
from openedx.core.djangoapps.waffle_utils.models import WaffleFlagCourseOverrideModel
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_switch
from xmodule.modulestore.tests.factories import CourseFactory
from ..videos import (

View File

@@ -41,6 +41,7 @@ from edxval.api import (
from opaque_keys.edx.keys import CourseKey
from pytz import UTC
from edx_toggles.toggles import WaffleFlagNamespace, WaffleSwitchNamespace
from edxmako.shortcuts import render_to_response
from openedx.core.djangoapps.video_config.models import VideoTranscriptEnabledFlag
from openedx.core.djangoapps.video_pipeline.config.waffle import (
@@ -48,7 +49,7 @@ from openedx.core.djangoapps.video_pipeline.config.waffle import (
ENABLE_DEVSTACK_VIDEO_UPLOADS,
waffle_flags
)
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag, WaffleFlagNamespace, WaffleSwitchNamespace
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag
from util.json_request import JsonResponse, expect_json
from xmodule.video_module.transcripts_utils import Transcript