Skip to content
Snippets Groups Projects
Unverified Commit 0cfda2d0 authored by Robert Raposa's avatar Robert Raposa Committed by GitHub
Browse files

Merge pull request #18857 from edx/arch/consolidate-request-cached-decorator

Cleanup and remove deprecated RequestCache Django app
parents 0b94a373 700a902b
No related branches found
No related tags found
No related merge requests found
Showing
with 76 additions and 51 deletions
...@@ -7,7 +7,7 @@ from rest_framework.response import Response ...@@ -7,7 +7,7 @@ from rest_framework.response import Response
from contentstore.views.item import highlights_setting from contentstore.views.item import highlights_setting
from edxval.api import get_videos_for_course from edxval.api import get_videos_for_course
from openedx.core.djangoapps.request_cache.middleware import request_cached from openedx.core.lib.cache_utils import request_cached
from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin, view_auth_classes from openedx.core.lib.api.view_utils import DeveloperErrorViewMixin, view_auth_classes
from openedx.core.lib.graph_traversals import traverse_pre_order from openedx.core.lib.graph_traversals import traverse_pre_order
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
...@@ -172,26 +172,27 @@ class CourseQualityView(DeveloperErrorViewMixin, GenericAPIView): ...@@ -172,26 +172,27 @@ class CourseQualityView(DeveloperErrorViewMixin, GenericAPIView):
durations=self._stats_dict(video_durations), durations=self._stats_dict(video_durations),
) )
@request_cached @classmethod
def _get_subsections_and_units(self, course, request): @request_cached()
def _get_subsections_and_units(cls, course, request):
""" """
Returns {subsection_key: {unit_key: {num_leaf_blocks: <>, leaf_block_types: set(<>) }}} Returns {subsection_key: {unit_key: {num_leaf_blocks: <>, leaf_block_types: set(<>) }}}
for all visible subsections and units. for all visible subsections and units.
""" """
_, visible_sections = self._get_sections(course) _, visible_sections = cls._get_sections(course)
subsection_dict = {} subsection_dict = {}
for section in visible_sections: for section in visible_sections:
visible_subsections = self._get_visible_children(section) visible_subsections = cls._get_visible_children(section)
if get_bool_param(request, 'exclude_graded', False): if get_bool_param(request, 'exclude_graded', False):
visible_subsections = [s for s in visible_subsections if not s.graded] visible_subsections = [s for s in visible_subsections if not s.graded]
for subsection in visible_subsections: for subsection in visible_subsections:
unit_dict = {} unit_dict = {}
visible_units = self._get_visible_children(subsection) visible_units = cls._get_visible_children(subsection)
for unit in visible_units: for unit in visible_units:
leaf_blocks = self._get_leaf_blocks(unit) leaf_blocks = cls._get_leaf_blocks(unit)
unit_dict[unit.location] = dict( unit_dict[unit.location] = dict(
num_leaf_blocks=len(leaf_blocks), num_leaf_blocks=len(leaf_blocks),
leaf_block_types=set(block.location.block_type for block in leaf_blocks), leaf_block_types=set(block.location.block_type for block in leaf_blocks),
...@@ -200,39 +201,44 @@ class CourseQualityView(DeveloperErrorViewMixin, GenericAPIView): ...@@ -200,39 +201,44 @@ class CourseQualityView(DeveloperErrorViewMixin, GenericAPIView):
subsection_dict[subsection.location] = unit_dict subsection_dict[subsection.location] = unit_dict
return subsection_dict return subsection_dict
@request_cached @classmethod
def _get_sections(self, course): @request_cached()
return self._get_all_children(course) def _get_sections(cls, course):
return cls._get_all_children(course)
def _get_all_children(self, parent): @classmethod
def _get_all_children(cls, parent):
store = modulestore() store = modulestore()
children = [store.get_item(child_usage_key) for child_usage_key in self._get_children(parent)] children = [store.get_item(child_usage_key) for child_usage_key in cls._get_children(parent)]
visible_children = [ visible_children = [
c for c in children c for c in children
if not c.visible_to_staff_only and not c.hide_from_toc if not c.visible_to_staff_only and not c.hide_from_toc
] ]
return children, visible_children return children, visible_children
def _get_visible_children(self, parent): @classmethod
_, visible_chidren = self._get_all_children(parent) def _get_visible_children(cls, parent):
_, visible_chidren = cls._get_all_children(parent)
return visible_chidren return visible_chidren
def _get_children(self, parent): @classmethod
def _get_children(cls, parent):
if not hasattr(parent, 'children'): if not hasattr(parent, 'children'):
return [] return []
else: else:
return parent.children return parent.children
def _get_leaf_blocks(self, unit): @classmethod
def _get_leaf_blocks(cls, unit):
def leaf_filter(block): def leaf_filter(block):
return ( return (
block.location.block_type not in ('chapter', 'sequential', 'vertical') and block.location.block_type not in ('chapter', 'sequential', 'vertical') and
len(self._get_children(block)) == 0 len(cls._get_children(block)) == 0
) )
return [ return [
block for block in block for block in
traverse_pre_order(unit, self._get_visible_children, leaf_filter) traverse_pre_order(unit, cls._get_visible_children, leaf_filter)
] ]
def _stats_dict(self, data): def _stats_dict(self, data):
......
...@@ -9,7 +9,7 @@ from config_models.models import ConfigurationModel ...@@ -9,7 +9,7 @@ from config_models.models import ConfigurationModel
from django.db.models import TextField from django.db.models import TextField
from opaque_keys.edx.django.models import CourseKeyField from opaque_keys.edx.django.models import CourseKeyField
from openedx.core.djangoapps.request_cache.middleware import request_cached from openedx.core.lib.cache_utils import request_cached
class StudioConfig(ConfigurationModel): class StudioConfig(ConfigurationModel):
...@@ -42,7 +42,7 @@ class CourseEditLTIFieldsEnabledFlag(ConfigurationModel): ...@@ -42,7 +42,7 @@ class CourseEditLTIFieldsEnabledFlag(ConfigurationModel):
course_id = CourseKeyField(max_length=255, db_index=True) course_id = CourseKeyField(max_length=255, db_index=True)
@classmethod @classmethod
@request_cached @request_cached()
def lti_access_to_learners_editable(cls, course_id, is_already_sharing_learner_info): def lti_access_to_learners_editable(cls, course_id, is_already_sharing_learner_info):
""" """
Looks at the currently active configuration model to determine whether Looks at the currently active configuration model to determine whether
......
...@@ -18,7 +18,7 @@ from opaque_keys.edx.keys import CourseKey ...@@ -18,7 +18,7 @@ from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.django.models import CourseKeyField from opaque_keys.edx.django.models import CourseKeyField
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.djangoapps.request_cache.middleware import ns_request_cached from openedx.core.lib.cache_utils import request_cached
Mode = namedtuple('Mode', Mode = namedtuple('Mode',
[ [
...@@ -311,7 +311,7 @@ class CourseMode(models.Model): ...@@ -311,7 +311,7 @@ class CourseMode(models.Model):
return [mode.to_tuple() for mode in found_course_modes] return [mode.to_tuple() for mode in found_course_modes]
@classmethod @classmethod
@ns_request_cached(CACHE_NAMESPACE) @request_cached(CACHE_NAMESPACE)
def modes_for_course(cls, course_id, include_expired=False, only_selectable=True): def modes_for_course(cls, course_id, include_expired=False, only_selectable=True):
""" """
Returns a list of the non-expired modes for a given course id Returns a list of the non-expired modes for a given course id
......
...@@ -11,7 +11,7 @@ from django_comment_common.models import ( ...@@ -11,7 +11,7 @@ from django_comment_common.models import (
Role Role
) )
from openedx.core.djangoapps.course_groups.cohorts import get_legacy_discussion_settings from openedx.core.djangoapps.course_groups.cohorts import get_legacy_discussion_settings
from openedx.core.djangoapps.request_cache.middleware import request_cached from openedx.core.lib.cache_utils import request_cached
from .models import CourseDiscussionSettings from .models import CourseDiscussionSettings
...@@ -110,7 +110,7 @@ def are_permissions_roles_seeded(course_id): ...@@ -110,7 +110,7 @@ def are_permissions_roles_seeded(course_id):
return True return True
@request_cached @request_cached()
def get_course_discussion_settings(course_key): def get_course_discussion_settings(course_key):
try: try:
course_discussion_settings = CourseDiscussionSettings.objects.get(course_id=course_key) course_discussion_settings = CourseDiscussionSettings.objects.get(course_id=course_key)
......
...@@ -11,9 +11,9 @@ from django.conf import settings ...@@ -11,9 +11,9 @@ from django.conf import settings
from mako.exceptions import TopLevelLookupException from mako.exceptions import TopLevelLookupException
from mako.lookup import TemplateLookup from mako.lookup import TemplateLookup
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 as themed_template
from openedx.core.djangoapps.theming.helpers import get_template_path_with_theme, strip_site_theme_templates_path from openedx.core.djangoapps.theming.helpers import get_template_path_with_theme, strip_site_theme_templates_path
from openedx.core.lib.cache_utils import request_cached
from . import LOOKUP from . import LOOKUP
...@@ -148,7 +148,7 @@ def add_lookup(namespace, directory, package=None, prepend=False): ...@@ -148,7 +148,7 @@ def add_lookup(namespace, directory, package=None, prepend=False):
templates.add_directory(directory, prepend=prepend) templates.add_directory(directory, prepend=prepend)
@request_cached @request_cached()
def lookup_template(namespace, name): def lookup_template(namespace, name):
""" """
Look up a Mako template by namespace and name. Look up a Mako template by namespace and name.
......
...@@ -22,8 +22,8 @@ Methods for creating RequestContext for using with Mako templates. ...@@ -22,8 +22,8 @@ Methods for creating RequestContext for using with Mako templates.
from crum import get_current_request from crum import get_current_request
from django.template import RequestContext from django.template import RequestContext
from openedx.core.djangoapps.request_cache import get_cache from edx_django_utils.cache import RequestCache
from util.request import safe_get_host from openedx.core.lib.request_utils import safe_get_host
def get_template_request_context(request=None): def get_template_request_context(request=None):
...@@ -38,7 +38,7 @@ def get_template_request_context(request=None): ...@@ -38,7 +38,7 @@ def get_template_request_context(request=None):
if request is None: if request is None:
return None return None
request_cache_dict = get_cache('edxmako') request_cache_dict = RequestCache('edxmako').data
cache_key = "request_context" cache_key = "request_context"
if cache_key in request_cache_dict: if cache_key in request_cache_dict:
return request_cache_dict[cache_key] return request_cache_dict[cache_key]
......
...@@ -50,6 +50,7 @@ from six import text_type ...@@ -50,6 +50,7 @@ from six import text_type
from slumber.exceptions import HttpClientError, HttpServerError from slumber.exceptions import HttpClientError, HttpServerError
from user_util import user_util from user_util import user_util
from edx_django_utils.cache import RequestCache
import lms.lib.comment_client as cc import lms.lib.comment_client as cc
from student.signals import UNENROLL_DONE, ENROLL_STATUS_CHANGE, ENROLLMENT_TRACK_UPDATED from student.signals import UNENROLL_DONE, ENROLL_STATUS_CHANGE, ENROLLMENT_TRACK_UPDATED
from lms.djangoapps.certificates.models import GeneratedCertificate from lms.djangoapps.certificates.models import GeneratedCertificate
...@@ -62,7 +63,6 @@ from courseware.models import ( ...@@ -62,7 +63,6 @@ from courseware.models import (
from enrollment.api import _default_course_mode from enrollment.api import _default_course_mode
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview 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.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.xmodule_django.models import NoneToEmptyManager from openedx.core.djangoapps.xmodule_django.models import NoneToEmptyManager
from openedx.core.djangolib.model_mixins import DeletableByUserValue from openedx.core.djangolib.model_mixins import DeletableByUserValue
...@@ -2069,7 +2069,7 @@ class CourseEnrollment(models.Model): ...@@ -2069,7 +2069,7 @@ class CourseEnrollment(models.Model):
""" """
# before populating the cache with another bulk set of data, # before populating the cache with another bulk set of data,
# remove previously cached entries to keep memory usage low. # remove previously cached entries to keep memory usage low.
clear_cache(cls.MODE_CACHE_NAMESPACE) RequestCache(cls.MODE_CACHE_NAMESPACE).clear()
records = cls.objects.filter(user__in=users, course_id=course_key).select_related('user') records = cls.objects.filter(user__in=users, course_id=course_key).select_related('user')
cache = cls._get_mode_active_request_cache() cache = cls._get_mode_active_request_cache()
...@@ -2080,9 +2080,9 @@ class CourseEnrollment(models.Model): ...@@ -2080,9 +2080,9 @@ class CourseEnrollment(models.Model):
@classmethod @classmethod
def _get_mode_active_request_cache(cls): def _get_mode_active_request_cache(cls):
""" """
Returns the request-specific cache for CourseEnrollment Returns the request-specific cache for CourseEnrollment as dict.
""" """
return get_cache(cls.MODE_CACHE_NAMESPACE) return RequestCache(cls.MODE_CACHE_NAMESPACE).data
@classmethod @classmethod
def _get_enrollment_in_request_cache(cls, user, course_key): def _get_enrollment_in_request_cache(cls, user, course_key):
......
...@@ -10,7 +10,7 @@ from collections import defaultdict ...@@ -10,7 +10,7 @@ from collections import defaultdict
from django.contrib.auth.models import User from django.contrib.auth.models import User
from opaque_keys.edx.django.models import CourseKeyField from opaque_keys.edx.django.models import CourseKeyField
from openedx.core.djangoapps.request_cache import get_cache from openedx.core.lib.cache_utils import get_cache
from student.models import CourseAccessRole from student.models import CourseAccessRole
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
......
...@@ -24,6 +24,7 @@ from student.models import ( ...@@ -24,6 +24,7 @@ from student.models import (
UserProfile, UserProfile,
get_retired_email_by_email get_retired_email_by_email
) )
from openedx.core.lib.request_utils import safe_get_host
from student.tests.factories import PendingEmailChangeFactory, RegistrationFactory, UserFactory from student.tests.factories import PendingEmailChangeFactory, RegistrationFactory, UserFactory
from student.views import ( from student.views import (
SETTING_CHANGE_INITIATED, SETTING_CHANGE_INITIATED,
...@@ -33,7 +34,6 @@ from student.views import ( ...@@ -33,7 +34,6 @@ from student.views import (
) )
from student.views import generate_activation_email_context, send_reactivation_email_for_user from student.views import generate_activation_email_context, send_reactivation_email_for_user
from third_party_auth.views import inactive_user_view from third_party_auth.views import inactive_user_view
from util.request import safe_get_host
from util.testing import EventTestMixin from util.testing import EventTestMixin
......
...@@ -5,7 +5,7 @@ from opaque_keys import InvalidKeyError ...@@ -5,7 +5,7 @@ from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from six import text_type from six import text_type
from util.request import COURSE_REGEX from openedx.core.lib.request_utils import COURSE_REGEX
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
......
...@@ -4,7 +4,7 @@ used in event tracking. ...@@ -4,7 +4,7 @@ used in event tracking.
""" """
from uuid import UUID, uuid4 from uuid import UUID, uuid4
from openedx.core.djangoapps.request_cache import get_cache from openedx.core.lib.cache_utils import get_cache
def get_event_transaction_id(): def get_event_transaction_id():
......
...@@ -9,7 +9,7 @@ from functools import wraps ...@@ -9,7 +9,7 @@ from functools import wraps
from django.db import DEFAULT_DB_ALIAS, DatabaseError, Error, transaction from django.db import DEFAULT_DB_ALIAS, DatabaseError, Error, transaction
from openedx.core.djangoapps.request_cache import get_cache from openedx.core.lib.cache_utils import get_cache
OUTER_ATOMIC_CACHE_NAME = 'db.outer_atomic' OUTER_ATOMIC_CACHE_NAME = 'db.outer_atomic'
......
...@@ -11,8 +11,8 @@ from milestones.services import MilestonesService ...@@ -11,8 +11,8 @@ from milestones.services import MilestonesService
from opaque_keys import InvalidKeyError from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.request_cache import get_cache
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.lib.cache_utils import get_cache
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
NAMESPACE_CHOICES = { NAMESPACE_CHOICES = {
......
...@@ -12,7 +12,8 @@ import logging ...@@ -12,7 +12,8 @@ import logging
from opaque_keys.edx.keys import UsageKey from opaque_keys.edx.keys import UsageKey
from opaque_keys.edx.locator import BlockUsageLocator from opaque_keys.edx.locator import BlockUsageLocator
from six import text_type from six import text_type
from openedx.core.lib.cache_utils import memoize_in_request_cache from openedx.core.lib.cache_utils import request_cached
from xblock.core import XBlock
from xmodule.exceptions import InvalidVersionError from xmodule.exceptions import InvalidVersionError
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.exceptions import ( from xmodule.modulestore.exceptions import (
...@@ -641,7 +642,6 @@ class DraftModuleStore(MongoModuleStore): ...@@ -641,7 +642,6 @@ class DraftModuleStore(MongoModuleStore):
bulk_record.dirty = True bulk_record.dirty = True
self.collection.remove({'_id': {'$in': to_be_deleted}}, safe=self.collection.safe) self.collection.remove({'_id': {'$in': to_be_deleted}}, safe=self.collection.safe)
@memoize_in_request_cache('request_cache')
def has_changes(self, xblock): def has_changes(self, xblock):
""" """
Check if the subtree rooted at xblock has any drafts and thus may possibly have changes Check if the subtree rooted at xblock has any drafts and thus may possibly have changes
...@@ -649,6 +649,18 @@ class DraftModuleStore(MongoModuleStore): ...@@ -649,6 +649,18 @@ class DraftModuleStore(MongoModuleStore):
:return: True if there are any drafts anywhere in the subtree under xblock (a weaker :return: True if there are any drafts anywhere in the subtree under xblock (a weaker
condition than for other stores) condition than for other stores)
""" """
return self._cached_has_changes(self.request_cache, xblock)
@request_cached(
# use the XBlock's location value in the cache key
arg_map_function=lambda arg: unicode(arg.location if isinstance(arg, XBlock) else arg),
# use this store's request_cache
request_cache_getter=lambda args, kwargs: args[1],
)
def _cached_has_changes(self, request_cache, xblock):
"""
Internal has_changes method that caches the result.
"""
# don't check children if this block has changes (is not public) # don't check children if this block has changes (is not public)
if getattr(xblock, 'is_draft', False): if getattr(xblock, 'is_draft', False):
return True return True
......
...@@ -7,7 +7,7 @@ from django.conf import settings ...@@ -7,7 +7,7 @@ from django.conf import settings
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
import logging import logging
from openedx.core.djangoapps.request_cache.middleware import request_cached from openedx.core.lib.cache_utils import request_cached
from xmodule.partitions.partitions import UserPartition, UserPartitionError, ENROLLMENT_TRACK_PARTITION_ID from xmodule.partitions.partitions import UserPartition, UserPartitionError, ENROLLMENT_TRACK_PARTITION_ID
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
...@@ -17,7 +17,7 @@ log = logging.getLogger(__name__) ...@@ -17,7 +17,7 @@ log = logging.getLogger(__name__)
FEATURES = getattr(settings, 'FEATURES', {}) FEATURES = getattr(settings, 'FEATURES', {})
@request_cached @request_cached()
def get_all_partitions_for_course(course, active_only=False): def get_all_partitions_for_course(course, active_only=False):
""" """
A method that returns all `UserPartitions` associated with a course, as a List. A method that returns all `UserPartitions` associated with a course, as a List.
......
...@@ -25,7 +25,7 @@ from lxml import etree ...@@ -25,7 +25,7 @@ from lxml import etree
from opaque_keys.edx.locator import AssetLocator from opaque_keys.edx.locator import AssetLocator
from openedx.core.djangoapps.video_config.models import HLSPlaybackEnabledFlag from openedx.core.djangoapps.video_config.models import HLSPlaybackEnabledFlag
from openedx.core.djangoapps.video_pipeline.config.waffle import waffle_flags, DEPRECATE_YOUTUBE from openedx.core.djangoapps.video_pipeline.config.waffle import waffle_flags, DEPRECATE_YOUTUBE
from openedx.core.lib.cache_utils import memoize_in_request_cache from openedx.core.lib.cache_utils import request_cached
from openedx.core.lib.license import LicenseMixin from openedx.core.lib.license import LicenseMixin
from xblock.completable import XBlockCompletionMode from xblock.completable import XBlockCompletionMode
from xblock.core import XBlock from xblock.core import XBlock
...@@ -1053,8 +1053,11 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler ...@@ -1053,8 +1053,11 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
""" """
return self.runtime.service(self, "request_cache") return self.runtime.service(self, "request_cache")
@memoize_in_request_cache('request_cache') @classmethod
def get_cached_val_data_for_course(self, video_profile_names, course_id): @request_cached(
request_cache_getter=lambda args, kwargs: args[1],
)
def get_cached_val_data_for_course(cls, request_cache, video_profile_names, course_id):
""" """
Returns the VAL data for the requested video profiles for the given course. Returns the VAL data for the requested video profiles for the given course.
""" """
...@@ -1087,7 +1090,11 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler ...@@ -1087,7 +1090,11 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
video_profile_names.append('hls') video_profile_names.append('hls')
# get and cache bulk VAL data for course # get and cache bulk VAL data for course
val_course_data = self.get_cached_val_data_for_course(video_profile_names, self.location.course_key) val_course_data = self.get_cached_val_data_for_course(
self.request_cache,
video_profile_names,
self.location.course_key,
)
val_video_data = val_course_data.get(self.edx_video_id, {}) val_video_data = val_course_data.get(self.edx_video_id, {})
# Get the encoded videos if data from VAL is found # Get the encoded videos if data from VAL is found
......
...@@ -9,7 +9,7 @@ from ccx_keys.locator import CCXBlockUsageLocator, CCXLocator ...@@ -9,7 +9,7 @@ from ccx_keys.locator import CCXBlockUsageLocator, CCXLocator
from django.db import transaction from django.db import transaction
from opaque_keys.edx.keys import CourseKey, UsageKey from opaque_keys.edx.keys import CourseKey, UsageKey
from openedx.core.djangoapps.request_cache import get_cache from openedx.core.lib.cache_utils import get_cache
from courseware.field_overrides import FieldOverrideProvider from courseware.field_overrides import FieldOverrideProvider
from lms.djangoapps.ccx.models import CcxFieldOverride, CustomCourseForEdX from lms.djangoapps.ccx.models import CcxFieldOverride, CustomCourseForEdX
......
...@@ -10,9 +10,9 @@ from wiki.models import reverse ...@@ -10,9 +10,9 @@ from wiki.models import reverse
from courseware.access import has_access from courseware.access import has_access
from courseware.courses import get_course_overview_with_access, get_course_with_access from courseware.courses import get_course_overview_with_access, get_course_with_access
from openedx.core.lib.request_utils import course_id_from_url
from openedx.features.enterprise_support.api import get_enterprise_consent_url from openedx.features.enterprise_support.api import get_enterprise_consent_url
from student.models import CourseEnrollment from student.models import CourseEnrollment
from util.request import course_id_from_url
class WikiAccessMiddleware(object): class WikiAccessMiddleware(object):
......
...@@ -5,9 +5,9 @@ This is meant to simplify the process of sending user preferences (espec. time_z ...@@ -5,9 +5,9 @@ This is meant to simplify the process of sending user preferences (espec. time_z
to the templates without having to append every view file. to the templates without having to append every view file.
""" """
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.errors import UserAPIInternalError, UserNotFound
from openedx.core.djangoapps.user_api.preferences.api import get_user_preferences from openedx.core.djangoapps.user_api.preferences.api import get_user_preferences
from openedx.core.lib.cache_utils import get_cache
RETRIEVABLE_PREFERENCES = { RETRIEVABLE_PREFERENCES = {
'user_timezone': 'time_zone', 'user_timezone': 'time_zone',
......
...@@ -5,7 +5,7 @@ Middleware for the courseware app ...@@ -5,7 +5,7 @@ Middleware for the courseware app
from django.shortcuts import redirect from django.shortcuts import redirect
from lms.djangoapps.courseware.exceptions import Redirect from lms.djangoapps.courseware.exceptions import Redirect
from util.request import COURSE_REGEX from openedx.core.lib.request_utils import COURSE_REGEX
class RedirectMiddleware(object): class RedirectMiddleware(object):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment