removed get_cache_key and using it from edx-django-utils.

This commit is contained in:
HammadAhmadWaqas
2020-04-13 12:09:50 +05:00
parent 20fe068a01
commit b4ebe11a6b
3 changed files with 8 additions and 32 deletions

View File

@@ -3,14 +3,13 @@ Utility methods for Enterprise
"""
import hashlib
import json
import six
from crum import get_current_request
from django.conf import settings
from django.utils.translation import ugettext as _
from edx_django_utils.cache import TieredCache
from edx_django_utils.cache.utils import get_cache_key
from enterprise.models import EnterpriseCustomerUser
from social_django.models import UserSocialAuth
@@ -21,30 +20,6 @@ from openedx.core.djangoapps.user_authn.cookies import standard_cookie_settings
from openedx.core.djangolib.markup import HTML, Text
def get_cache_key(**kwargs):
"""
Get MD5 encoded cache key for given arguments.
Here is the format of key before MD5 encryption.
key1:value1__key2:value2 ...
Example:
>>> get_cache_key(site_domain="example.com", resource="enterprise-learner")
# Here is key format for above call
# "site_domain:example.com__resource:enterprise-learner"
a54349175618ff1659dee0978e3149ca
Arguments:
**kwargs: Key word arguments that need to be present in cache key.
Returns:
An MD5 encoded key uniquely identified by the key word arguments.
"""
key = '__'.join(['{}:{}'.format(item, value) for item, value in six.iteritems(kwargs)])
return hashlib.md5(key.encode('utf-8')).hexdigest()
def get_data_consent_share_cache_key(user_id, course_id):
"""
Returns cache key for data sharing consent needed against user_id and course_id