Cleanup and remove deprecated RequestCache Django app

ARCH-223
This commit is contained in:
Nimisha Asthagiri
2018-08-30 14:32:29 -04:00
committed by Robert Raposa
parent 53d8a04b88
commit 700a902b68
54 changed files with 595 additions and 600 deletions

View File

@@ -12,7 +12,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 openedx.core.djangoapps.request_cache.middleware import request_cached
from openedx.core.lib.cache_utils import request_cached
def has_permission(user, permission, course_id=None):
@@ -33,7 +33,7 @@ def has_permission(user, permission, course_id=None):
CONDITIONS = ['is_open', 'is_author', 'is_question_author', 'is_team_member_if_applicable']
@request_cached
@request_cached()
def get_team(commentable_id):
""" Returns the team that the commentable_id belongs to if it exists. Returns None otherwise. """
try:

View File

@@ -27,7 +27,7 @@ from django_comment_common.models import (
)
from django_comment_common.utils import get_course_discussion_settings
from openedx.core.djangoapps.course_groups.cohorts import get_cohort_id, get_cohort_names, is_course_cohorted
from openedx.core.djangoapps.request_cache.middleware import request_cached
from openedx.core.lib.cache_utils import request_cached
from student.models import get_user_by_username_or_email
from student.roles import GlobalStaff
from xmodule.modulestore.django import modulestore
@@ -137,7 +137,7 @@ def get_accessible_discussion_xblocks(course, user, include_all=False):
return get_accessible_discussion_xblocks_by_course_id(course.id, user, include_all=include_all)
@request_cached
@request_cached()
def get_accessible_discussion_xblocks_by_course_id(course_id, user=None, include_all=False): # pylint: disable=invalid-name
"""
Return a list of all valid discussion xblocks in this course.
@@ -169,7 +169,7 @@ class DiscussionIdMapIsNotCached(Exception):
pass
@request_cached
@request_cached()
def get_cached_discussion_key(course_id, discussion_id):
"""
Returns the usage key of the discussion xblock associated with discussion_id if it is cached. If the discussion id
@@ -236,7 +236,7 @@ def get_discussion_id_map_by_course_id(course_id, user):
return dict(map(get_discussion_id_map_entry, xblocks))
@request_cached
@request_cached()
def _get_item_from_modulestore(key):
return modulestore().get_item(key)
@@ -856,7 +856,7 @@ def get_group_id_for_comments_service(request, course_key, commentable_id=None):
return None
@request_cached
@request_cached()
def get_group_id_for_user_from_cache(user, course_id):
"""
Caches the results of get_group_id_for_user, but serializes the course_id