Move request_cache to openedx.core.djangoapps

This commit is contained in:
Qubad786
2018-01-26 03:30:54 +05:00
parent 7a552f7446
commit 64555c60c0
57 changed files with 77 additions and 86 deletions

View File

@@ -5,7 +5,7 @@ to configure flags related to persistent grading.
from contextlib import contextmanager
from contentstore.config.models import NewAssetsPageFlag, CourseNewAssetsPageFlag
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
@contextmanager

View File

@@ -9,7 +9,7 @@ from config_models.models import ConfigurationModel
from django.db.models import TextField
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from request_cache.middleware import request_cached
from openedx.core.djangoapps.request_cache.middleware import request_cached
class StudioConfig(ConfigurationModel):

View File

@@ -7,7 +7,7 @@ import ddt
from django.test import TestCase
from opaque_keys.edx.locator import CourseLocator
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from xblock_config.models import CourseEditLTIFieldsEnabledFlag

View File

@@ -457,7 +457,7 @@ else:
MIDDLEWARE_CLASSES = [
'crum.CurrentRequestUserMiddleware',
'request_cache.middleware.RequestCache',
'openedx.core.djangoapps.request_cache.middleware.RequestCache',
'openedx.core.djangoapps.monitoring_utils.middleware.MonitoringMemoryMiddleware',

View File

@@ -17,7 +17,7 @@ from openedx.core.djangoapps.content.course_overviews.models import CourseOvervi
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from request_cache.middleware import RequestCache, ns_request_cached
from openedx.core.djangoapps.request_cache.middleware import RequestCache, ns_request_cached
Mode = namedtuple('Mode',
[

View File

@@ -11,7 +11,7 @@ from django_comment_common.models import (
Role
)
from openedx.core.djangoapps.course_groups.cohorts import get_legacy_discussion_settings
from request_cache.middleware import request_cached
from openedx.core.djangoapps.request_cache.middleware import request_cached
from .models import CourseDiscussionSettings

View File

@@ -11,7 +11,7 @@ from django.conf import settings
from mako.exceptions import TopLevelLookupException
from mako.lookup import TemplateLookup
from request_cache.middleware import request_cached
from openedx.core.djangoapps.request_cache.middleware import request_cached
from openedx.core.djangoapps.theming.helpers import get_template as themed_template
from openedx.core.djangoapps.theming.helpers import get_template_path_with_theme, strip_site_theme_templates_path

View File

@@ -22,7 +22,7 @@ Methods for creating RequestContext for using with Mako templates.
from crum import get_current_request
from django.template import RequestContext
import request_cache
from openedx.core.djangoapps.request_cache import get_cache
from util.request import safe_get_host
@@ -38,7 +38,7 @@ def get_template_request_context(request=None):
if request is None:
return None
request_cache_dict = request_cache.get_cache('edxmako')
request_cache_dict = get_cache('edxmako')
cache_key = "request_context"
if cache_key in request_cache_dict:
return request_cache_dict[cache_key]

View File

@@ -12,7 +12,7 @@ from mock import Mock, patch
from edxmako import LOOKUP, add_lookup
from edxmako.request_context import get_template_request_context
from edxmako.shortcuts import is_any_marketing_link_set, is_marketing_link_set, marketing_link, render_to_string
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from student.tests.factories import UserFactory
from util.testing import UrlResetMixin

View File

@@ -48,7 +48,6 @@ from slumber.exceptions import HttpClientError, HttpServerError
import dogstats_wrapper as dog_stats_api
import lms.lib.comment_client as cc
import request_cache
from student.signals import UNENROLL_DONE, ENROLL_STATUS_CHANGE, ENROLLMENT_TRACK_UPDATED
from lms.djangoapps.certificates.models import GeneratedCertificate
from course_modes.models import CourseMode
@@ -60,6 +59,7 @@ from courseware.models import (
from enrollment.api import _default_course_mode
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.djangoapps.request_cache import clear_cache, get_cache
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, NoneToEmptyManager
from track import contexts
@@ -1870,7 +1870,7 @@ class CourseEnrollment(models.Model):
"""
# before populating the cache with another bulk set of data,
# remove previously cached entries to keep memory usage low.
request_cache.clear_cache(cls.MODE_CACHE_NAMESPACE)
clear_cache(cls.MODE_CACHE_NAMESPACE)
records = cls.objects.filter(user__in=users, course_id=course_key).select_related('user')
cache = cls._get_mode_active_request_cache()
@@ -1883,7 +1883,7 @@ class CourseEnrollment(models.Model):
"""
Returns the request-specific cache for CourseEnrollment
"""
return request_cache.get_cache(cls.MODE_CACHE_NAMESPACE)
return get_cache(cls.MODE_CACHE_NAMESPACE)
@classmethod
def _get_enrollment_in_request_cache(cls, user, course_key):

View File

@@ -10,7 +10,7 @@ from collections import defaultdict
from django.contrib.auth.models import User
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from request_cache import get_cache
from openedx.core.djangoapps.request_cache import get_cache
from student.models import CourseAccessRole
log = logging.getLogger(__name__)

View File

@@ -4,7 +4,7 @@ used in event tracking.
"""
from uuid import UUID, uuid4
from request_cache import get_cache
from openedx.core.djangoapps.request_cache import get_cache
def get_event_transaction_id():

View File

@@ -9,7 +9,7 @@ from functools import wraps
from django.db import DEFAULT_DB_ALIAS, DatabaseError, Error, transaction
import request_cache
from openedx.core.djangoapps.request_cache import get_cache
OUTER_ATOMIC_CACHE_NAME = 'db.outer_atomic'
@@ -160,7 +160,7 @@ def enable_named_outer_atomic(*names):
if len(names) == 0:
raise ValueError("At least one name must be specified.")
cache = request_cache.get_cache(OUTER_ATOMIC_CACHE_NAME)
cache = get_cache(OUTER_ATOMIC_CACHE_NAME)
for name in names:
cache[name] = True
@@ -187,7 +187,7 @@ class OuterAtomic(transaction.Atomic):
connection = transaction.get_connection(self.using)
cache = request_cache.get_cache(OUTER_ATOMIC_CACHE_NAME)
cache = get_cache(OUTER_ATOMIC_CACHE_NAME)
# By default it is enabled.
enable = True

View File

@@ -11,7 +11,7 @@ from milestones.services import MilestonesService
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
import request_cache
from openedx.core.djangoapps.request_cache import get_cache
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from xmodule.modulestore.django import modulestore
@@ -359,7 +359,7 @@ def get_course_content_milestones(course_id, content_id=None, relationship='requ
if user_id is None:
return milestones_api.get_course_content_milestones(course_id, content_id, relationship)
request_cache_dict = request_cache.get_cache(REQUEST_CACHE_NAME)
request_cache_dict = get_cache(REQUEST_CACHE_NAME)
if user_id not in request_cache_dict:
request_cache_dict[user_id] = {}

View File

@@ -24,19 +24,12 @@ import django.dispatch
import django.utils
from django.utils.translation import get_language, to_locale
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from xmodule.contentstore.django import contentstore
from xmodule.modulestore.draft_and_published import BranchSettingMixin
from xmodule.modulestore.mixed import MixedModuleStore
from xmodule.util.django import get_current_request_hostname
try:
# We may not always have the request_cache module available
from request_cache.middleware import RequestCache
HAS_REQUEST_CACHE = True
except ImportError:
HAS_REQUEST_CACHE = False
# We also may not always have the current request user (crum) module available
try:
from xblock_django.user_service import DjangoXBlockUserService
@@ -256,10 +249,7 @@ def create_modulestore_instance(
if key in _options and isinstance(_options[key], basestring):
_options[key] = load_function(_options[key])
if HAS_REQUEST_CACHE:
request_cache = RequestCache.get_request_cache()
else:
request_cache = None
request_cache = RequestCache.get_request_cache()
try:
metadata_inheritance_cache = caches['mongo_metadata_inheritance']

View File

@@ -212,6 +212,7 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers,
return track_url, transcript_language, sorted_languages
def get_html(self):
track_status = (self.download_track and self.track)
transcript_download_format = self.transcript_download_format if not track_status else None
sources = filter(None, self.html5_sources)

View File

@@ -9,7 +9,7 @@ from ccx_keys.locator import CCXBlockUsageLocator, CCXLocator
from django.db import transaction
from opaque_keys.edx.keys import CourseKey, UsageKey
import request_cache
from openedx.core.djangoapps.request_cache import get_cache
from courseware.field_overrides import FieldOverrideProvider
from lms.djangoapps.ccx.models import CcxFieldOverride, CustomCourseForEdX
@@ -67,7 +67,7 @@ def get_current_ccx(course_key):
if not isinstance(course_key, CCXLocator):
return None
ccx_cache = request_cache.get_cache('ccx')
ccx_cache = get_cache('ccx')
if course_key not in ccx_cache:
ccx_cache[course_key] = CustomCourseForEdX.objects.get(pk=course_key.ccx)
@@ -120,7 +120,7 @@ def _get_overrides_for_ccx(ccx):
Returns a dictionary mapping field name to overriden value for any
overrides set on this block for this CCX.
"""
overrides_cache = request_cache.get_cache('ccx-overrides')
overrides_cache = get_cache('ccx-overrides')
if ccx not in overrides_cache:
overrides = {}

View File

@@ -22,7 +22,7 @@ from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.content.block_structure.api import get_course_in_cache
from openedx.core.djangoapps.waffle_utils.testutils import WAFFLE_TABLES
from pytz import UTC
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from student.models import CourseEnrollment
from student.tests.factories import UserFactory
from xblock.core import XBlock

View File

@@ -17,7 +17,7 @@ from lms.djangoapps.ccx.models import CustomCourseForEdX
from lms.djangoapps.ccx.overrides import override_field_for_ccx
from lms.djangoapps.ccx.tests.utils import flatten, iter_blocks
from lms.djangoapps.courseware.tests.test_field_overrides import inject_field_overrides
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from student.tests.factories import AdminFactory
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory

View File

@@ -37,7 +37,7 @@ from lms.djangoapps.ccx.views import get_date
from lms.djangoapps.grades.tasks import compute_all_grades_for_course
from lms.djangoapps.instructor.access import allow_access, list_with_level
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from student.models import CourseEnrollment, CourseEnrollmentAllowed
from student.roles import CourseCcxCoachRole, CourseInstructorRole, CourseStaffRole
from student.tests.factories import AdminFactory, CourseEnrollmentFactory, UserFactory

View File

@@ -9,7 +9,7 @@ from django.contrib.auth.models import AnonymousUser
from django.dispatch import receiver
from openedx.core.djangoapps.commerce.utils import is_commerce_service_configured
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from student.signals import REFUND_ORDER
from .utils import refund_seat

View File

@@ -5,7 +5,7 @@ This is meant to simplify the process of sending user preferences (espec. time_z
to the templates without having to append every view file.
"""
import request_cache
from openedx.core.djangoapps.request_cache import get_cache
from openedx.core.djangoapps.user_api.errors import UserAPIInternalError, UserNotFound
from openedx.core.djangoapps.user_api.preferences.api import get_user_preferences
@@ -25,7 +25,7 @@ def user_timezone_locale_prefs(request):
system/browser set time_zones and languages
"""
cached_value = request_cache.get_cache(CACHE_NAME)
cached_value = get_cache(CACHE_NAME)
if not cached_value:
user_prefs = {
'user_timezone': None,

View File

@@ -10,7 +10,7 @@ from course_modes.models import CourseMode
from openedx.features.course_experience.course_tools import CourseTool
from student.models import CourseEnrollment
from courseware.date_summary import verified_upgrade_deadline_link
from request_cache import get_request
from openedx.core.djangoapps.request_cache import get_request
class VerifiedUpgradeTool(CourseTool):

View File

@@ -21,7 +21,7 @@ from contextlib import contextmanager
from django.conf import settings
from xblock.field_data import FieldData
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from xmodule.modulestore.inheritance import InheritanceMixin
NOTSET = object()

View File

@@ -11,7 +11,7 @@ from django_comment_common.models import CourseDiscussionSettings, all_permissio
from django_comment_common.utils import get_course_discussion_settings
from lms.djangoapps.teams.models import CourseTeam
from lms.lib.comment_client import Thread
from request_cache.middleware import RequestCache, request_cached
from openedx.core.djangoapps.request_cache.middleware import RequestCache, request_cached
def has_permission(user, permission, course_id=None):

View File

@@ -22,7 +22,7 @@ from django_comment_common.models import FORUM_ROLE_STUDENT, CourseDiscussionSet
from django_comment_common.utils import get_course_discussion_settings
from openedx.core.djangoapps.content.course_structures.models import CourseStructure
from openedx.core.djangoapps.course_groups.cohorts import get_cohort_id, get_cohort_names, is_course_cohorted
from request_cache.middleware import request_cached
from openedx.core.djangoapps.request_cache.middleware import request_cached
from student.models import get_user_by_username_or_email
from student.roles import GlobalStaff
from xmodule.modulestore.django import modulestore

View File

@@ -11,7 +11,7 @@ from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory
from lms.djangoapps.grades.tests.utils import answer_problem
from openedx.core.djangolib.testing.utils import get_mock_request
from openedx.core.lib.gating import api as gating_api
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from student.tests.factories import UserFactory
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase

View File

@@ -8,7 +8,7 @@ from django.db.models import BooleanField, IntegerField, TextField
from six import text_type
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from request_cache.middleware import request_cached
from openedx.core.djangoapps.request_cache.middleware import request_cached
class PersistentGradesEnabledFlag(ConfigurationModel):

View File

@@ -5,7 +5,7 @@ to configure flags related to persistent grading.
from contextlib import contextmanager
from lms.djangoapps.grades.config.models import CoursePersistentGradesFlag, PersistentGradesEnabledFlag
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
@contextmanager

View File

@@ -22,7 +22,7 @@ from opaque_keys.edx.keys import CourseKey, UsageKey
from coursewarehistoryextended.fields import UnsignedBigIntAutoField, UnsignedBigIntOneToOneField
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, UsageKeyField
from request_cache import get_cache
from openedx.core.djangoapps.request_cache import get_cache
import events

View File

@@ -66,7 +66,7 @@ from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory
from openedx.core.djangoapps.credit.tests.factories import CreditCourseFactory
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme
from openedx.core.djangoapps.util.testing import ContentGroupTestCase, TestConditionalContent
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from shoppingcart.models import (
Coupon,
CourseRegistrationCode,

View File

@@ -12,7 +12,7 @@ from lms.djangoapps.completion.services import CompletionService
from openedx.core.djangoapps.user_api.course_tag import api as user_course_tag_api
from openedx.core.lib.url_utils import quote_slashes
from openedx.core.lib.xblock_utils import xblock_local_resource_url
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from xmodule.library_tools import LibraryToolsService
from xmodule.modulestore.django import ModuleI18nService, modulestore
from xmodule.partitions.partitions_service import PartitionService

View File

@@ -8,7 +8,7 @@ from django.core.cache import cache
from django.http import HttpResponse
from pytz import UTC
import request_cache
from openedx.core.djangoapps.request_cache import get_cache
from mobile_api.mobile_platform import MobilePlatform
from mobile_api.models import AppVersionConfig
from mobile_api.utils import parsed_version
@@ -52,7 +52,7 @@ class AppVersionUpgrade(object):
2. EDX-APP-VERSION-LAST-SUPPORTED-DATE; if user app version < min supported version and
timestamp < expiry of that version
"""
request_cache_dict = request_cache.get_cache(self.REQUEST_CACHE_NAME)
request_cache_dict = get_cache(self.REQUEST_CACHE_NAME)
if request_cache_dict:
last_supported_date = request_cache_dict[self.LAST_SUPPORTED_DATE_HEADER]
if last_supported_date != self.NO_LAST_SUPPORTED_DATE:
@@ -92,7 +92,7 @@ class AppVersionUpgrade(object):
if user_agent:
platform = self._get_platform(request, user_agent)
if platform:
request_cache_dict = request_cache.get_cache(self.REQUEST_CACHE_NAME)
request_cache_dict = get_cache(self.REQUEST_CACHE_NAME)
request_cache_dict[self.USER_APP_VERSION] = platform.version
last_supported_date_cache_key = self._get_cache_key_name(
self.LAST_SUPPORTED_DATE_HEADER,

View File

@@ -11,7 +11,7 @@ from elasticsearch.exceptions import ConnectionError
from search.search_engine_base import SearchEngine
from lms.djangoapps.teams.models import CourseTeam
from request_cache import get_request_or_stub
from openedx.core.djangoapps.request_cache import get_request_or_stub
from .errors import ElasticSearchConnectionError
from .serializers import CourseTeamSerializer

View File

@@ -1267,7 +1267,7 @@ else:
MIDDLEWARE_CLASSES = [
'crum.CurrentRequestUserMiddleware',
'request_cache.middleware.RequestCache',
'openedx.core.djangoapps.request_cache.middleware.RequestCache',
'openedx.core.djangoapps.monitoring_utils.middleware.MonitoringCustomMetrics',
'mobile_api.middleware.AppVersionUpgrade',
@@ -3332,7 +3332,7 @@ AUDIT_CERT_CUTOFF_DATE = None
CREDENTIALS_SERVICE_USERNAME = 'credentials_service_user'
CREDENTIALS_GENERATION_ROUTING_KEY = HIGH_PRIORITY_QUEUE
WIKI_REQUEST_CACHE_MIDDLEWARE_CLASS = "request_cache.middleware.RequestCache"
WIKI_REQUEST_CACHE_MIDDLEWARE_CLASS = "openedx.core.djangoapps.request_cache.middleware.RequestCache"
# Settings for Comprehensive Theming app

View File

@@ -5,7 +5,7 @@ import logging
from django.core.exceptions import ObjectDoesNotExist
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError

View File

@@ -3,7 +3,7 @@ This module contains various configuration settings via
waffle switches for the Block Structure framework.
"""
from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace
from request_cache.middleware import request_cached
from openedx.core.djangoapps.request_cache.middleware import request_cached
from .models import BlockStructureConfiguration

View File

@@ -6,7 +6,6 @@ forums, and to the cohort admin views.
import logging
import random
import request_cache
from courseware import courses
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
@@ -17,7 +16,8 @@ from django.dispatch import receiver
from django.http import Http404
from django.utils.translation import ugettext as _
from eventtracking import tracker
from request_cache.middleware import request_cached
from openedx.core.djangoapps.request_cache import clear_cache, get_cache
from openedx.core.djangoapps.request_cache.middleware import request_cached
from student.models import get_user_by_username_or_email
from .models import (
@@ -175,8 +175,8 @@ def bulk_cache_cohorts(course_key, users):
"""
# before populating the cache with another bulk set of data,
# remove previously cached entries to keep memory usage low.
request_cache.clear_cache(COHORT_CACHE_NAMESPACE)
cache = request_cache.get_cache(COHORT_CACHE_NAMESPACE)
clear_cache(COHORT_CACHE_NAMESPACE)
cache = get_cache(COHORT_CACHE_NAMESPACE)
if is_course_cohorted(course_key):
cohorts_by_user = {
@@ -215,7 +215,7 @@ def get_cohort(user, course_key, assign=True, use_cached=False):
Raises:
ValueError if the CourseKey doesn't exist.
"""
cache = request_cache.get_cache(COHORT_CACHE_NAMESPACE)
cache = get_cache(COHORT_CACHE_NAMESPACE)
cache_key = _cohort_cache_key(user.id, course_key)
if use_cached and cache_key in cache:
@@ -514,7 +514,7 @@ def get_group_info_for_cohort(cohort, use_cached=False):
use_cached=True to use the cached value instead of fetching from the
database.
"""
cache = request_cache.get_cache(u"cohorts.get_group_info_for_cohort")
cache = get_cache(u"cohorts.get_group_info_for_cohort")
cache_key = unicode(cohort.id)
if use_cached and cache_key in cache:

View File

@@ -12,7 +12,7 @@ from django.utils import six, timezone
from opaque_keys.edx.keys import CourseKey
from py2neo import Graph, Node, Relationship, authenticate, NodeSelector
from py2neo.compat import integer, string, unicode as neo4j_unicode
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
log = logging.getLogger(__name__)

View File

@@ -23,7 +23,7 @@ from jsonfield.fields import JSONField
from model_utils.models import TimeStampedModel
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from request_cache.middleware import RequestCache, ns_request_cached
from openedx.core.djangoapps.request_cache.middleware import RequestCache, ns_request_cached
CREDIT_PROVIDER_ID_REGEX = r"[a-z,A-Z,0-9,\-]+"
log = logging.getLogger(__name__)

View File

@@ -14,7 +14,7 @@ from uuid import uuid4
import psutil
import request_cache
from openedx.core.djangoapps.request_cache import get_cache
from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace
log = logging.getLogger(__name__)
@@ -41,7 +41,7 @@ class MonitoringCustomMetrics(object):
Get a reference to the part of the request cache wherein we store New
Relic custom metrics related to the current request.
"""
return request_cache.get_cache(name=REQUEST_CACHE_KEY)
return get_cache(name=REQUEST_CACHE_KEY)
@classmethod
def accumulate_metric(cls, name, value):
@@ -108,7 +108,7 @@ class MonitoringMemoryMiddleware(object):
"""
Namespaced request cache for tracking memory usage.
"""
return request_cache.get_cache(name='monitoring_memory')
return get_cache(name='monitoring_memory')
def _log_prefix(self, prefix, request):
"""

View File

@@ -13,7 +13,7 @@ import crum
from django.conf import settings
from django.test.client import RequestFactory
from request_cache import middleware
from openedx.core.djangoapps.request_cache import middleware
log = logging.getLogger(__name__)

View File

@@ -8,8 +8,8 @@ from django.test import TestCase
from django.test.utils import override_settings
from mock import Mock
from request_cache import get_request_or_stub
from request_cache.middleware import RequestCache, request_cached
from openedx.core.djangoapps.request_cache import get_request_or_stub
from openedx.core.djangoapps.request_cache.middleware import RequestCache, request_cached
from xmodule.modulestore.django import modulestore

View File

@@ -8,7 +8,7 @@ from courseware.module_render import get_module_for_descriptor
from courseware.model_data import FieldDataCache
from openedx.core.djangoapps.schedules.config import COURSE_UPDATE_WAFFLE_FLAG
from openedx.core.djangoapps.schedules.exceptions import CourseUpdateDoesNotExist
from request_cache import get_request_or_stub
from openedx.core.djangoapps.request_cache import get_request_or_stub
from xmodule.modulestore.django import modulestore

View File

@@ -19,7 +19,7 @@ from openedx.core.djangoapps.theming.helpers_dirs import (
get_theme_dirs,
get_themes_unchecked
)
from request_cache.middleware import RequestCache, request_cached
from openedx.core.djangoapps.request_cache.middleware import RequestCache, request_cached
logger = getLogger(__name__) # pylint: disable=invalid-name

View File

@@ -12,7 +12,7 @@ from openedx.core.djangoapps.theming import helpers as theming_helpers
from openedx.core.djangoapps.theming.helpers import get_template_path_with_theme, strip_site_theme_templates_path, \
get_themes, Theme, get_theme_base_dir
from openedx.core.djangolib.testing.utils import skip_unless_cms, skip_unless_lms
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
class TestHelpers(TestCase):

View File

@@ -8,7 +8,7 @@ UserCourseTag model.
"""
from collections import defaultdict
from request_cache import get_cache
from openedx.core.djangoapps.request_cache import get_cache
from ..models import UserCourseTag
# Scopes

View File

@@ -18,7 +18,7 @@ from openedx.core.djangoapps.course_groups.cohorts import (
)
from openedx.core.djangoapps.verified_track_content.tasks import sync_cohort_with_mode
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from request_cache.middleware import RequestCache, ns_request_cached
from openedx.core.djangoapps.request_cache.middleware import RequestCache, ns_request_cached
from student.models import CourseEnrollment
log = logging.getLogger(__name__)

View File

@@ -54,7 +54,7 @@ import six
from opaque_keys.edx.keys import CourseKey
from waffle import flag_is_active, switch_is_active
from request_cache import get_cache as get_request_cache
from openedx.core.djangoapps.request_cache import get_cache as get_request_cache
log = logging.getLogger(__name__)

View File

@@ -8,7 +8,7 @@ from six import text_type
from config_models.models import ConfigurationModel
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
from request_cache.middleware import request_cached
from openedx.core.djangoapps.request_cache.middleware import request_cached
class WaffleFlagCourseOverrideModel(ConfigurationModel):

View File

@@ -7,7 +7,7 @@ from django.test import TestCase
from django.test.client import RequestFactory
from mock import patch
from opaque_keys.edx.keys import CourseKey
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from waffle.testutils import override_flag
from .. import CourseWaffleFlag, WaffleFlagNamespace

View File

@@ -5,7 +5,7 @@ from ddt import data, ddt, unpack
from django.test import TestCase
from opaque_keys.edx.keys import CourseKey
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from ..models import WaffleFlagCourseOverrideModel

View File

@@ -7,7 +7,7 @@ from django.test import TestCase
from django.test.client import RequestFactory
from opaque_keys.edx.keys import CourseKey
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
from .. import CourseWaffleFlag, WaffleFlagNamespace
from ..testutils import override_waffle_flag

View File

@@ -19,7 +19,7 @@ from django.core.cache import caches
from django.db import DEFAULT_DB_ALIAS, connections
from django.test import RequestFactory, TestCase, override_settings
from django.test.utils import CaptureQueriesContext
from request_cache.middleware import RequestCache
from openedx.core.djangoapps.request_cache.middleware import RequestCache
class CacheIsolationMixin(object):

View File

@@ -3,7 +3,7 @@ from contextlib import contextmanager
from crum import CurrentRequestUserMiddleware
from openedx.core.djangoapps.theming.middleware import CurrentSiteThemeMiddleware
from django.http import HttpResponse
from request_cache import get_request_or_stub
from openedx.core.djangoapps.request_cache import get_request_or_stub
@contextmanager

View File

@@ -5,7 +5,7 @@ from opaque_keys.edx.keys import CourseKey
from lms.djangoapps.course_api.blocks.api import get_blocks
from lms.djangoapps.course_blocks.utils import get_student_module_as_dict
from request_cache.middleware import request_cached
from openedx.core.djangoapps.request_cache.middleware import request_cached
from xmodule.modulestore.django import modulestore